modbus-poll and learning tool modbus-slave protocol function code using --modbus parse the input register 04 is read --04

Function code function is to read the input register 4, following is a transmission of communication modbus poll taken, the response data,
the Tx: 020-01 04 00 00 00 01 31 is the CA
the Rx: 021-01 04 02 00 02 38 is Fl

As follows:
poll terminal:
Connection Options not go into detail, RTU mode, the communication 8N1.

setup options, select the following:

Click ok, you can communicate a.
slave terminal:
Connection Options not go into detail, RTU mode, the communication 8N1.

 setup options, select the following:

Click ok, you can communicate a.
The two are set up, you can communicate a. Here I use a virtual serial port, if it is the actual situation, it is necessary to select the serial number of the actual situation.

Communication follows:

Analysis Code Communication:
the Tx: 020-01 (slave address) 04 (Function Code 4) 00 (start address register high) 00 (start address register high) 00 (a high number of registers) 01 (a high number of registers) 31 (CRC low) CA (CRC MSB)
described beginning from the register 1, read the value of a register
Rx: 021-01 (slave address) 04 (function code 4) 02 (bytes) 00 (high data (address 30000)) 02 (data lower (address 30000)) 38 (CRC low) F1 (CRC MSB)
can appear, the RX data is the reply 16bit data, two bytes.

 

 

Guess you like

Origin www.cnblogs.com/CodeWorkerLiMing/p/12127765.html