TModbus.h
上传用户:wuxg88
上传日期:2022-05-28
资源大小:814k
文件大小:2k
源码类别:

通讯编程

开发平台:

C++ Builder

  1. //---------------------------------------------------------------------------
  2. #ifndef TModbusH
  3. #define TModbusH
  4. //---------------------------------------------------------------------------
  5. #include <Classes.hpp>
  6. #include <Controls.hpp>
  7. #include <StdCtrls.hpp>
  8. #include <Forms.hpp>
  9. #include <ExtCtrls.hpp>
  10. //---------------------------------------------------------------------------
  11. class TForm1 : public TForm
  12. {
  13. __published: // IDE-managed Components
  14.         TButton *Button1;
  15.         TTimer *Timer1;
  16.         TButton *Button2;
  17.         TButton *Button3;
  18.         TMemo *Memo1;
  19.         TEdit *Edit1;
  20.         TTimer *Timer2;
  21.         void __fastcall Button1Click(TObject *Sender);
  22.         void __fastcall Button2Click(TObject *Sender);
  23.         void __fastcall Button3Click(TObject *Sender);
  24.         void __fastcall Timer1Timer(TObject *Sender);
  25.         void __fastcall Timer2Timer(TObject *Sender);
  26. private: // User declarations
  27. public: // User declarations
  28.       unsigned char sendbuf[50];       // 传送Buffer
  29.       unsigned char recvbuf[1024];       // 接收Buffer
  30.       int ipaddr;                      // 网络IP
  31.       int modbus_addr;                 // 回传站号
  32.       int modbus_func;                 // 回传功能码
  33.       int modbus_addr_ret;             // 回传站号
  34.       int modbus_func_ret;             // 回传功能码
  35.       int datalen;                     // Buffer数据长度
  36.       int comm_type ;               // 通讯种类, 0:序列埠, 1:以太网络
  37.       int conn_num ;                 // 序列埠编号或联机识别码
  38.         __fastcall TForm1(TComponent* Owner);
  39. };
  40. //---------------------------------------------------------------------------
  41. extern PACKAGE TForm1 *Form1;
  42. //---------------------------------------------------------------------------
  43. #endif