C# Modbus communication from entry to proficiency (15) - Modbus ASCII (0x03 function code and C# code implementation)

insert image description here

1. 03 (0x03) read holding register

Use this function code to read the value of 1 to 125 holding registers from the remote address, each holding register occupies two bytes, and the number of holding registers to be read is specified by the master station when reading.

2. Send message format

insert image description here

The more detailed format is as follows:
start character + slave station address + function code + high start address + low start address + high number of registers + low number of registers + LRC + end character, a total of 17 bytes, of which the LRC calculation excludes Start character, end character.

3. Return message format

insert image description here

The more detailed format is as follows:
start character + slave station address + function code + number of bytes occupied by the register + low byte of register value + ... + high byte of register value + LRC + terminator, assuming that the number of registers is N, a total of 4N+11 bytes

4. Case

Slave address: 1
Start address: 0
Number of registers: 3
Suppose you want to read the values ​​of 3 registers whose slave address is 1 and start address is 0, then

Guess you like

Origin blog.csdn.net/qq_34059233/article/details/131857102
Recommended