TModbus.h
资源名称:test.rar [点击查看]
上传用户:wuxg88
上传日期:2022-05-28
资源大小:814k
文件大小:2k
源码类别:
通讯编程
开发平台:
C++ Builder
- //---------------------------------------------------------------------------
- #ifndef TModbusH
- #define TModbusH
- //---------------------------------------------------------------------------
- #include <Classes.hpp>
- #include <Controls.hpp>
- #include <StdCtrls.hpp>
- #include <Forms.hpp>
- #include <ExtCtrls.hpp>
- //---------------------------------------------------------------------------
- class TForm1 : public TForm
- {
- __published: // IDE-managed Components
- TButton *Button1;
- TTimer *Timer1;
- TButton *Button2;
- TButton *Button3;
- TMemo *Memo1;
- TEdit *Edit1;
- TTimer *Timer2;
- void __fastcall Button1Click(TObject *Sender);
- void __fastcall Button2Click(TObject *Sender);
- void __fastcall Button3Click(TObject *Sender);
- void __fastcall Timer1Timer(TObject *Sender);
- void __fastcall Timer2Timer(TObject *Sender);
- private: // User declarations
- public: // User declarations
- unsigned char sendbuf[50]; // 传送Buffer
- unsigned char recvbuf[1024]; // 接收Buffer
- int ipaddr; // 网络IP
- int modbus_addr; // 回传站号
- int modbus_func; // 回传功能码
- int modbus_addr_ret; // 回传站号
- int modbus_func_ret; // 回传功能码
- int datalen; // Buffer数据长度
- int comm_type ; // 通讯种类, 0:序列埠, 1:以太网络
- int conn_num ; // 序列埠编号或联机识别码
- __fastcall TForm1(TComponent* Owner);
- };
- //---------------------------------------------------------------------------
- extern PACKAGE TForm1 *Form1;
- //---------------------------------------------------------------------------
- #endif