首页 > 其他分享 >CH9121网口配置协议及说明

CH9121网口配置协议及说明

时间:2024-01-11 09:58:22浏览次数:35  
标签:协议 00 0000 MODULE 网口 CH9121 NET define

(1)结构体定义

(2)通信流程详解

1.通讯方式

2.通讯结构体

3.通讯过程

①搜索

②获取配置

③配置

④恢复出厂设置

(3)相关文档下载

CH9121搜素配置协议

(1)结构体定义

  1 // 定义了与网络CH9121通信的基本数据结构,和配置结构,参数等
  2 
  3 #ifndef __MODULECONFIG_H__
  4 #define __MODULECONFIG_H__
  5 
  6 //变量类型定义
  7 #define UCHAR  unsigned char
  8 #define USHORT unsigned short
  9 #define ULONG  unsigned long
 10 
 11 #define NET_MODULE_DATA_LENGTH    255   //与CH9121通信时数据区的最大长度
 12 
 13 #define MODULE_CFG_LEN_NEW   ( 74 + 65*2 )
 14 
 15 //通信命令码
 16 #define NET_MODULE_CMD_SET      0X01    //配置网络中的CH9121
 17 #define NET_MODULE_CMD_GET      0X02    //获取某个CH9121的配置
 18 #define NET_MODULE_CMD_RESET    0X03    //获取某个CH9121的配置
 19 #define NET_MODULE_CMD_SEARCH   0X04    //搜索网络中的CH9121
 20 
 21 #define NET_MODULE_CMD_SET_BAUD            0X09        //配置网络中的模块
 22 
 23 //应答命令码
 24 #define NET_MODULE_ACK_SET      0X81    //回应配置命令码
 25 #define NET_MODULE_ACK_GET      0X82    //回应获取命令码
 26 #define NET_MODULE_ACK_RESET    0X83    //获取某个CH9121的配置
 27 #define NET_MODULE_ACK_SEARCH   0X84    //回应所搜命令码
 28 
 29 #define NET_MODULE_ACK_SET_BAUD            0X89        //配置网络中的模块
 30 
 31 //校验和错误时的应答命令码
 32 #define NET_MODULE_NAK_SEARCH    0xC0    //搜索校验错
 33 #define NET_MODULE_NAK_SET       0XC1    //配置校验错
 34 #define NET_MODULE_NAK_GET       0XC2    //获取校验错
 35 
 36 #define CH9121_CFG_FLAG        "CH9121_CFG_FLAG"    //用来标识通信
 37 
 38 
 39 //网络通信结构体
 40 typedef struct NET_COMM {
 41   unsigned char flag[16];                     //通信标识,因为都是用广播方式进行通信的,所以这里加一个固定值
 42   unsigned char cmd;                          //命令头
 43   unsigned char id[6];                        //CH9121MAC地址
 44   unsigned char pcid[6];                      //PC的MAC地址
 45   unsigned char len;                          //数据区长度
 46   unsigned char data[NET_MODULE_DATA_LENGTH]; //数据区缓冲区
 47 }net_comm,*pnet_comm;
 48 
 49 //CH9121标识
 50 #define  NET_MODULE_TYPE_TCP_S    0X00         //CH9121作为TCP SERVER
 51 #define  NET_MODULE_TYPE_TCP_C    0X01         //CH9121作为TCP CLIENT
 52 #define  NET_MODULE_TYPE_UDP_S    0X02         //CH9121作为UDP SERVER
 53 #define NET_MODULE_TYPE_UDP_C     0X03         //CH9121作为UDP CLIENT
 54 
 55 //校验位标识
 56 #define NET_MODULE_VERIFY_NULL    0X04         //无校验
 57 #define NET_MODULE_VERIFY_ODD     0X00         //奇校验
 58 #define NET_MODULE_VERIFY_EVEN    0X01         //偶校验
 59 #define NET_MODULE_VERIFY_MARK    0X02         //mark校验
 60 #define NET_MODULE_VERIFY_SPACE   0X03         //space校验
 61 
 62 
 63 /* 设备硬件信息结构体定义 */
 64 #define CH9121_DEV_TYPE             0x30
 65 #define CH9121_DEV_AUX_TYPE         0x01
 66 #define CH9121_DEV_HARDWARE_VER     0x02
 67 #define CH9121_DEV_SOFTWARE_VER     0x02   
 68 
 69 /* 子设备配置信息结构体定义 */
 70 
 71 #define CH9121_DevType         0x21
 72 #define CH9121_AuxDevType      0x21
 73 #define CH9121_DevbIndex       0x01
 74 #define CH9121_DevHardwareVer  0x02
 75 #define CH9121_SoftwareVer     0x02
 76 #define CH9121_VER    (((CH9121_DevHardwareVer<<4) & 0xF0) | (CH9121_SoftwareVer & 0x0f))
 77 
 78 
 79 
 80 __packed typedef struct _DEVICEHW_CONFIG
 81 {
 82   UCHAR  bDevType;                /* 设备类型,只读 */
 83   UCHAR  bAuxDevType;             /* 设备子类型, 只读*/
 84   UCHAR  bIndex;                  /* 设备序号, 只读*/
 85   UCHAR  bDevHardwareVer;         /* 设备硬件版本号,只读 */  
 86   UCHAR  bDevSoftwareVer;         /* 设备软件版本号,只读 */  
 87   UCHAR  szModulename[21];        /* 用户名同CH9121名*/
 88   UCHAR  bDevMAC[ 6 ];            /* CH9121网络MAC地址 */  
 89   UCHAR  bDevIP[ 4 ];             /* CH9121IP地址*/
 90   UCHAR  bDevGWIP[ 4 ];           /* CH9121网关IP */
 91   UCHAR  bDevIPMask[ 4 ];         /* CH9121子网掩码 */
 92   UCHAR  bDhcpEnable;             /* DHCP 使能,是否启用DHCP,1:启用,0:不启用*/
 93   USHORT breserved1;              /* 预留暂未启用 */
 94   UCHAR  breserved2[8];           /* 预留暂未启用*/
 95   UCHAR  breserved3;              /* 预留暂未启用*/
 96   UCHAR  breserved4[8];           /* 预留暂未启用*/
 97   UCHAR  breserved5;              /* 预留暂未启用*/
 98   UCHAR  bComcfgEn;               /* 串口协商配置标志 1:启用 0:禁用*/
 99   UCHAR  breserved6[8];           /* 预留暂未启用*/
100 }DeviceHWConfigS,*pDeviceHWConfigS;
101 
102 __packed typedef struct _DEVICEPORT_CONFIG
103 {
104   UCHAR  bIndex;                   /* 子设备序号,只读  */
105   UCHAR  bPortEn;                  /* 端口启用标志 1:启用 ;0:不启用 */
106   UCHAR  bNetMode;                 /* 网络工作模式: 0: TCP SERVER;1: TCP CLENT; 2: UDP SERVER 3:UDP CLIENT; */
107   UCHAR  bRandSportFlag;           /* TCP 客户端模式下随机本地端口号,1:随机 0: 不随机*/
108   USHORT wNetPort;                 /* 本地端口号 */  
109   UCHAR  bDesIP[ 4 ];              /* 目的IP地址 */
110   USHORT wDesPort;                 /* 目的端口号 */
111   ULONG  dBaudRate;                /* 串口波特率: 300---921600bps */
112   UCHAR  bDataSize;                /* 串口数据位: 5---8位 */  
113   UCHAR  bStopBits;                /* 串口停止位: 0表示1个停止位; 1表示1.5个停止位; 2表示2个停止位 */  
114   UCHAR  bParity;                  /* 串口校验位: 4表示无校验,0表示奇校验; 1表示偶校验; 2表示标志位(MARK,置1); 3表示空白位(SPACE,清0);  */    
115   UCHAR  bPHYChangeHandle;         /* PHY断开,Socket动作,1:关闭Socket 0:不动作*/
116   ULONG  dRxPktlength;             /* 串口RX数据打包长度,最大1024 */
117   ULONG  dRxPktTimeout;            /* 串口RX数据打包转发的最大等待时间,单位为: 10ms,0则表示关闭超时功能 */
118   UCHAR  bResv;                    /* 预留未启用*/  
119   UCHAR  bResetCtrl;               /* 串口复位操作: 0表示不清空串口数据缓冲区; 1表示连接时清空串口数据缓冲区 */  
120   UCHAR  bDNSFlag;                 /* 域名功能启用标志,1:启用 0:不启用*/
121   UCHAR  szDomainname[20];         /* TCP客户端模式下,目的地址,域名*/
122   UCHAR  breserved[14];            /* 保留*/
123 }DevicePortConfigS,*pDevicePortConfigS;
124 
125 
126 __packed typedef struct _NET_DEVICE_CONFIG
127 {   
128   DeviceHWConfigS     HWCfg;        /*网络参数结构体*/
129   DevicePortConfigS   PortCfg[2];   /*透传通道参数*/
130 }NetDeviceConfigS,*pNetDeviceConfigS;
131 
132 
133 
134 #endif

(2)通信流程详解

1.通讯方式
CH9121 通过 UDP 广播方式进行网络配置功能。
CH9121 广播本地接收端口:50000,上位机广播本地接收端口:60000。
2.通讯结构体

 1 CH9121 和上位机通讯数据包格式为:
 2 typedef struct NET_COMM {
 3 unsigned char flag[16]; //通信标识,"CH9121_CFG_FLAG"
 4 unsigned char cmd; //命令头
 5 unsigned char id[6]; //CH9121MAC 地址
 6 unsigned char pcid[6]; //PC 的 MAC 地址
 7 unsigned char len; //数据区长度
 8 unsigned char data[NET_MODULE_DATA_LENGTH]; //数据区缓冲区
 9 }net_comm,*pnet_comm;
10 其中在配置和获取配置阶段 data[NET_MODULE_DATA_LENGTH]结构如下: 11 __packed typedef struct _NET_DEVICE_CONFIG 12 { 13 DeviceHWConfigS HWCfg; /*网络参数结构体*/ 14 DevicePortConfigS PortCfg[2]; /*透传通道参数*/ 15 }NetDeviceConfigS,*pNetDeviceConfigS; 16 其中 PortCfg[1]为默认开启的透传通道,并且支持手册全部功能,建议使用单通道的时候默认使用此透传通道。 18 PortCfg[0]为辅助端口,仅支持基本透传功能。

 3.通讯过程

  CH9121上位机配置功能主要包括:①搜索,②获取配置,③配置网络参数,④恢复出厂设置。

  下面结合通讯过程中的数据包解析设置流程。(wireshark抓包可以抓取到数据包)

①搜索

-->PC下发的搜索包:

43 48 39 31 32 31 5f 43 46 47 5f 46 4c 41 47 00     //16字节固定通信标识
04                          //1字节命令头
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

<--9121回复的应答包:

 

43 48 39 31 32 31 5f 43 46 47 5f 46 4c 41 47 00      //16字节固定通信标识
84 //1字节命令头
38 3b 26 44 de a5                    //6字节9121自身MAC地址
00 00 00 00 00 00
0c
c0 a8 01 02                         //6字节9121自身IP地址
43 48 39 31 32 31                 //设备名
2000
29                        //固件版本
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00

 

②获取配置

-->PC下发的获取配置请求包

43 48 39 31 32 31 5f 43 46 47 5f 46 4c 41 47 00   //16字节固定头
02                        //1字节命令头
38 3b 26 44 de a5                   //6字节9121自身MAC地址
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

 

<--9121的应答包:

43 48 39 31 32 31 5f 43 46 47 5f 46 4c 41 47 00                // 16字节固定头
82                                //1字节命令头
38 3b 26 44 de a5                            //6字节9121自身MAC地址
00 00 00 00 00 00
cc

21                                  //设备类型
21                                 //设备子类型
01                                 //设备序号
02                                //设备硬件版本号
06                                //设备软件版本号
43 48 39 31 32 31 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00     //设备名
38 3b 26 44 de a5                            //9121_mac地址
c0 a8 01 02                            //9121_ip地址
c0 a8 01 01                            //9121_网关
ff ff ff 00                                //9121_掩码
00                                //DHCP使能,是否启用DHCP,1为启用,0为关闭
50 00                                   //WEB网页地址
00 00 00 00 00 00 00 00                          //用户名同模块名
00                                //密码使能 1:使能 0: 禁用
00 00 00 00 00 00 00 00                            //密码*/
ff                                    //固件升级标志,1:升级 0:不升级
00                                //串口协商进入配置模式使能,1:使能 0:不使能 
00 00 00 00 00 00 00 00                         //保留

00                                //端口序号
00                                   //端口启用标志 1:启用后 ;0:不启用
02                                   //网络工作模式: 0: TCP SERVER;1: TCP CLENT; 2: UDP SERVER 3:UDP CLIENT;
01                                //TCP 客户端模式下随即本地端口号,1:随机 0: 不随机
b8 0b                                //网络通讯端口号 
c0 a8 01 64                            //目的IP地址 
d0 07                                 //工作于TCP Server模式时,允许外部连接的端口号
80 25 00 00                            //串口波特率: 300---921600bps 
08                                 //串口数据位: 5---8位
01                                 //串口停止位: 1表示1个停止位; 2表示2个停止位 
04                                      //串口校验位: 0表示奇校验; 1表示偶校验; 2表示标志位(MARK,置1); 3表示空白位(SPACE,清0); 
01                                     //PHY断开,Socket动作,1:关闭Socket 2、不动作
00 04 00 00                                   //串口RX数据打包长度,最大1024
00 00 00 00                                   //串口RX数据打包转发的最大等待时间,单位为: 10ms,0则表示关闭超时功能
00                                               //工作于TCP CLIENT时,连接TCP SERVER的最大重试次数*/
00                                          //串口复位操作: 0表示不清空串口数据缓冲区; 1表示连接时清空串口数据缓冲区 
00                                //域名功能启用标志,1:启用 2:不启用
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00       //域名
00 00 00 00                            //DNS 主机
00 00                                 //DNS 端口
00 00 00 00 00 00 00 00                       //保留

01                      /**************端口2的相关信息参考上面端口1******************/
01                              
00                            
01                              
64 09                                 
c0 a8 01 64                                 
e8 03                              
00 e1 00 00                        
08                                  
01                           
04                                    
01                         
00 04 00 00                          
00 00 00 00                         
00                          
00                        
00                                  
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                    
00 00 00 00                                       
00 00                                  
00 00 00 00 00 00 00 00                                 

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00            //最后 51个00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00

 

③进行网络参数配置

-->PC下发的获取配置请求包

43 48 39 31 32 31 5f 43 46 47 5f 46 4c 41 47 00                //固定头
01                                    //命令头
38 3b 26 44 de a5                             //9121自身的MAC地址
00 e0 4c 36 35 5a                             //对端的MAC地址
cc                                    //数据区长度
21                                      /**************下面数据具体含义和上面类似,参考上面******************/
21
01
02
06
43 48 39 31 32 31 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00
38 3b 26 44 de a5
c0 a8 01 1e
c0 a8 01 01
ff ff ff 00
00
50 00
00 00 00 00 00 00 00 00
00
00 00 00 00 00 00 00 00
ff
00
00 00 00 00 00 00 00 00
00                                           //端口1
01
02
01
b8 0b
c0 a8 01 64
d0 07
80 25 00 00
08
01
04
01
00 04 00 00
00 00 00 00
00
00
00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00
00 00
00 00 00 00 00 00 00 00
01                                              //端口2
01
01
01
d0 07
c0 a8 01 6e
e8 03
00 c2 01 00
08
01
04
01 
00 04 00 00
00 00 00 00
00
00
00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00
00 00
00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00

 

<--9121回复的应答包

43 48 39 31 32 31 5f 43 46 47 5f 46 4c 41 47 00            //固定头
81                                //命令头
38 3b 26 44 de a5                          //9121自身的MAC地址
00 e0 4c 36 35 5a                          //对端的MAC地址
00                              /**************下面数据具体含义和上面类似,参考上面******************/
21
21
01
02
06
43 48 39 31 32 31 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00
38 3b 26 44 de a5
c0 a8 01 1e
c0 a8 01 01
ff ff ff 00
00
50 00
00 00 00 00 00 00 00 00
00
00 00 00 00 00 00 00 00
ff
00
00 00 00 00 00 00 00 00                         
00                                              //端口1信息
01
02
01
b8 0b
c0 a8 01 64
d0 07
80 25 00 00
08
01
04
01
00 04 00 00
00 00 00 00
00
00
00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00
00 00
00 00 00 00 00 00 00 00
01                                                 //端口2
01
01
01
d0 07
c0 a8 01 6e
e8 03
00 c2 01 00
08
01
04
01
00 04 00 00
00 00 00 00
00
00
00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00
00 00
00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00

 

④恢复出厂设置

-->PC机下发的恢复出厂请求包:

43 48 39 31 32 31 5f 43 46 47 5f 46 4c 41 47 00            //固定头
03                                 //命令头
38 3b 26 44 de a5                          //9121自身的MAC地址
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 

 

<--9121应答包

43 48 39 31 32 31 5f 43 46 47 5f 46 4c 41 47 00          //固定头
83                              //命令头
38 3b 26 44 de a5                        //9121自身的MAC地址
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

 


 

上位机搜索软件及协议demo:https://files.cnblogs.com/files/blogs/808422/%E6%90%9C%E7%B4%A2%E8%BD%AF%E4%BB%B6DEMO.zip?t=1704937203&download=true

标签:协议,00,0000,MODULE,网口,CH9121,NET,define
From: https://www.cnblogs.com/wchwchlq/p/17954976

相关文章

  • ICMP协议
    ICMP协议(网际控制报文协议)特征:1、ICMP报文被封装在IP报文的数据载荷部分;2、ICMP协议发送差错报告报文与询问报文;差错报告类型:-终点不可达-源点抑制-超时(数据包经过路由器时TTL的值会减1,当TTL的值减为0时,主机或者路由器会丢弃该报文,并且向源发送主机发送ICMP协议)-参数......
  • 网工们,这11种协议报文格式一定要烂熟于心!
    01、TCP1、源端口号和目的端口号:用16bit表示所以端口号范围为0~65535,用来标识源主机和目的主机上的进程,用于运输层的多路复用和多路分解。2、序号:用于TCP重发时区分是第一次发送还是重发的TCP段,还可以在一次连接的范围防止重放攻击,不重数可以在很久时间防止重放攻击。3、重放攻击......
  • 深入理解HTTP协议状态码的应用场景和准确解读方法
    Laravel是一个流行的PHP框架,它具有出色的可测试性,可以帮助开发人员在更短的时间内编写可靠的代码。但是,即使使用了这个框架,也可能会出现测试覆盖率较低的情况。测试覆盖率是指代码中已由测试案例覆盖的部分比例。测试覆盖率越高,代码质量越高。在本文中,我们将分享几种技巧,帮助您提......
  • python通过RS485、Modbus协议读取/修改仪表数据
    目标python通过RS485的Modbus协议读取仪表相应的寄存器数据。准备工作软件安装第三方库:serial、pyserial、modbus_tkpipinstallserialpipinstallpyserialpipinstallmodbus_tk硬件一根USB转RS485的转接线(电脑本身不带RS485接口时需要)一个带Modbus通讯的仪表(例子中使用的时一......
  • 实现DLT645 698电表数据转换成modbus协议的解决方案
    1 项目背景在一些能源监控项目或者抄表项目中,需要实时采集电能表的数据进行电量分析和远程监控。但是在一些场合,现场的电表是645的电力规约,这些规约还分成1997和2007两个版本。而监控中心的通信协议一般使用工业modbus通信。645协议远比modbus要复杂的多,需要多帧数据的通信才能完......
  • 网工我劝你,这11种协议报文格式要烂熟于心!
    你们好,我的网工朋友。你最熟悉的报文是啥?TCP、UDP?在网络世界里,就如同道路系统让车辆畅通无阻一样,网络协议是确保信息顺畅传输的关键。作为网络工程师,理解网络协议的种类与结构至关重要。今天就和你一起探索一下11种关键协议报文格式啊:包括TCP、UDP、IP、IPv6、IPSec、以太网帧结构......
  • 最大输出 18W,集成 Type-C PD 输出和各种快充输出协议
    一、产品简介IP6510是一款集成同步开关的降压转换器、支持9种输出快充协议、支持Type-C输出和USBPD协议,为车载充电器、快充适配器、智能排插提供完整的解决方案。IP6510内置功率MOS,输入电压范围是4.5V到32V,输出电压范围是3V到12V,能提供最大18W的输出功率,能够根据识别......
  • PN协议下,上位机如何通过RJ45口远程控制PLC?
    在实际系统中,车间里分布多台PLC,需要用上位机软件集中控制。通常所有设备距离在几十米到上百米不等。在有通讯需求的时候,如果布线的话,工程量较大且不美观,这种情况下比较适合采用无线通信方式。本方案以组态王和2台西门子S7-1200为例,介绍组态王与多台PLC的无线Profinet协议通信实现......
  • SSH 协议 和 Go SSH 库 转载
    导读 SSH,TheSecureShellProtocol(安全Shell协议),是一个使用广泛的网络协议。在中文互联网世界,关于SSH协议的介绍,往往都把重点放到了安全(Secure)方面的细节。这样的文章对于开发者来说,意义并不大,原因在于:此类文章是以密码学为基础的。而密码学专业程度较高,对于开发......
  • 代理IP常见的三种网络协议介绍
    代理IP也叫网络代理,是一种特殊的网络服务,允许一个网络终端通过这个服务与另一个网络终端进行非直接的连接。伴随着互联网的发展,目前越来越多的业务依赖于代理IP才能顺利开展。一般来说我们使用的IP代理一般会涉及到三种协议,分别是:HTTP、HTTPS以及SOCKS5。HTTPHTTP协议即超文本传输......