Communication parameter group 07
PARAMETER DESCRIPTION 211
Message
Content
②
Function information
group
At present, there are four functions. Slave device acts according to the request of Master device. If
Master device sets a function code other than the table below, Slave device will return an error
response. Normal function code will be returned when response is normal, and H80+ function code will
be returned when response is wrong.
Function name
Function code
Function description
Read multiple
registers
H03
Read Slave’s continuous register content.
Write single register H06
Write data into Slave’s single register.
Function diagnosis
H08
Function diagnosis(only for communication check)
Write multiple
registers
H10
Data can be written to Slave’s multiple registers.
③
Data information
group
Change
according to function code, including initial address, number of registers written and read, data
written, etc.
④
Error checking
information group
ASCII is the check method for LRC, while RTU is the check method for CRC.
Calculation of LRC check value in ASCII mode:
LRC check is relatively simple, which is used in ASCII mode and can detect all contents in the information
domain except the starting colon and the ending carriage return character, it superimpose each data to be
transmitted according to bytes (not ASCII code). If the obtained result is greater than hexadecimal H100,
remove the excess part (for example, if hexadecimal H136 is obtained, only retain H36), obtain the inverse code
of the remaining part and add 1 to it..
Calculation of CRC check value in RTU mode:
1. Add a 16-bit register with every bit set to 1.
2. Perform an xor operation between the upper byte of the 16-bit register and the initial 8-bit byte, the result of
which is put into this 16-bit register.
3. Move this 16-bit register one bit to the right.
4. If the bit moved to the right (marked bit) is 1, perform an xor operation between the generated polynomial
1010000000000001 with this register. If the bit moved to the right is 0, 3 will be returned.
5. Repeat steps 3 and 4 until 8 bits are removed.
6. Perform an xor operation between another 8 bits with this 16-bit register.
7. Repeat steps 3 to 6 until all bytes of the message are performed xor operation with the 16-bit register and bit
has been moved for 8 times.
8. The content of this 16-bit register is the 2-byte CRC error check code, which will be added to the highest
significant bit of the message.
When adding CRC to the message, the low byte is added first, then the high byte.
Communication format:
1.
Data readout (H03)
Mode
Start
Address*1) Function*2) Start Address*3)
Number of
register*4)
Check
Stop
ASCII
H3A
2char
2char
4char
4char
2char
0D 0A
RTU
>=10ms
8bit
8bit
2byte
2byte
2byte
>=10ms