预览加载中,请您耐心等待几秒...
1/9
2/9
3/9
4/9
5/9
6/9
7/9
8/9
9/9

在线预览结束,喜欢就下载吧,查找使用更方便

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

ModbusRTU协议2023.05.08BigQ功能码:0102030405061516功能码:01读取线圈状态读取从站为1起始地址为0数量为10主站发送报文:01010000000abc0d01:从站地址Type:Byte01:功能码;Type:Byte0000:读取从站的起始地址;Type:Word(主站访问实际起始地址=报文地址+1)000a:读取总共的线圈个数,10个;Type:Wordbc0d:CRC校验;Type:Word从站返回报文:0101020700bbcc01:从站地址Type:Byte01:功能码Type:Byte02:返回字节个数(每读8个BIT线圈为一个字节BYTE)Type:Byte0700:返回线圈状态,读取10个线圈状态,用两个字节存储(00000111,00000000)Type:Bytebbcc:发送CRC校验码Type:Word如下图功能码:02读取输入状态读取从站为1起始地址为10数量为10主站发送报文:01020009000a280f01:从站地址Type:Byte02:功能码;Type:Byte0000:读取从站的起始地址;Type:Word(主站访问实际起始地址=报文地址+1)000a:读取总共的输入个数,10个;Type:Word280f:CRC校验;Type:Word从站返回报文:0102020000b9b801:从站地址Type:Byte02:功能码Type:Byte02:返回字节个数(每读8个BIT线圈为一个字节BYTE)Type:Byte0000:返回线圈状态,读取10个线圈状态,用两个字节存储(00000000,00000000)Type:Byteb9b8:发送CRC校验码Type:Word如下图功能码:03读取保持型寄存器读取从站为1起始地址为10数量为10主站发送报文:01030009000a15cf01:从站地址Type:Byte03:功能码;Type:Byte0009:读取从站的起始地址;Type:Word(主站访问实际起始地址=报文地址+1)000a:读取总共的输入个数,10个;Type:Word15cf:CRC校验;Type:Word从站返回报文:0103140000000000000000000000000000000000000000a36701:从站地址Type:Byte03:功能码Type:Byte14:返回字节个数(每读1个寄存器为二个字节BYTE)Type:Byte0000000000000000000000000000000000000000一个寄存器用两个字节存储,读取10个寄存器为20个字节Type:Byteb9b8:发送CRC校验码Type:Word如下图:功能码:04读取输入寄存器读取从站为1起始地址为10数量为10主站发送报文:01040009000aa00f01:从站地址Type:Byte04:功能码;Type:Byte0009:读取从站的起始地址;Type:Word(主站访问实际起始地址=报文地址+1)000a:读取总共的输入个数,10个;Type:Worda00f:CRC校验;Type:Word从站返回报文:0104140000000000000000000000000000000000000000958101:从站地址Type:Byte04:功能码Type:Byte14:返回字节个数(每读1个寄存器为二个字节BYTE)Type:Byte0000000000000000000000000000000000000000一个寄存器用两个字节存储,读取10个寄存器为20个字节Type:Byte发送CRC校验码:9581Type:Word如下图:功能码:15写多个线圈寄存器读取从站为1起始地址为0数量为10主站发送报文:010f0000000a021e00ec9801:从站地址Type:Byte0f:功能码;Type:Byte0000:读取从站的起始地址;Type:Word(主站访问实际起始地址=报文地址+1)000a:写入总共的线圈个数,10个;Type:Word02:总字节数(8个线圈占用一个字节,多余的再占用一个)Type:Byte1e00:写入数据的值(0111100000000000)Type:Byteec98:CRC校验;Type:Word从站返回报文:010f14000000000ad5cc01:从站地址Type:Byte0f:功能码Type:Byte0000:返回起始地址Type:Word000a:返回读取寄存器个数Type:Wordd5cc:发送CRC校验码Type:Word如下图功能码:16写多个保持型寄存器读取从站为1起始地址为0数量为4主站发送报文:0110000000040801000101000100001