⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 comtrans.h

📁 一个dll演示代码 用于串口通信的。 类似于工控的驱动
💻 H
字号:

// The following ifdef block is the standard way of creating macros which make exporting 
// from a DLL simpler. All files within this DLL are compiled with the COMTRANS_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see 
// COMTRANS_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported.
#ifdef COMTRANS_EXPORTS
#define COMTRANS_API __declspec(dllexport)
#else
#define COMTRANS_API __declspec(dllimport)
#endif

// This class is exported from the ComTrans.dll
class COMTRANS_API CComTrans 
{
public:
	CComTrans(void);
	// TODO: add your methods here.
};

extern COMTRANS_API int nComTrans;

COMTRANS_API int fnComTrans(void);
/*------------------------com口操作------------------*/
//参数初始化
extern "C" COMTRANS_API bool   InitPortExt( int pPort, int nBaudRate, int nParity, int nByteSize, int nStopBits, int nTimeout);
//打开端口
extern "C" COMTRANS_API bool  OpenPort();
//关闭端口
extern "C" COMTRANS_API bool  ClosePort();
//设置端口
extern "C" COMTRANS_API bool  SetPort(const int Pro, int Value);
//获取端口设置
extern "C" COMTRANS_API int  GetPortSet(const int Pro);
//获取端口状态
extern "C" COMTRANS_API bool  GetPortState();
/*---------------------------设备操作-------------------*/
//通用通信函数,获取设备信息
extern "C" COMTRANS_API bool  SendEquipmentCommand(const int EquipmentNum,const int CommandID);
//设置设备
extern "C" COMTRANS_API bool  SetEquipmentData(const int EquipmentNum,const int Pro,const int Setvalue);
//得到pv温度
extern "C" COMTRANS_API bool  SendGetPVCommand(const int EquipmentNum);
//得到sv温度
extern "C" COMTRANS_API bool   SendGetSVCommand(const int EquipmentNum);
/*------------读取设备数据-----------------*/
//获取设备数据
extern "C" COMTRANS_API float   GetEquipmentData();
//获取数据
extern "C" COMTRANS_API float  GetPVData();
//获取sv数据
extern "C" COMTRANS_API float   GetSVData();
/*---------------错误处理函数--------------*/
//获取最后一条错误文本
extern "C"  COMTRANS_API void	 GetLastErrorText(char **returnvalue);
//获取最后一种错误类型编号
extern "C"  COMTRANS_API int GetLastErrorNumber();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -