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

insert image description here

1, 10 (0x10) write multiple holding registers

Use this function code to write the value of multiple holding registers to the remote address

2. Send message format

insert image description here

The more detailed format is as follows:
The more detailed format is as follows:
start character + slave station address + function code + register start address high + register start address low + register quantity high byte + register quantity low byte + register occupation Number of bytes + low byte of register value + ... + high byte of register value + LRC + terminator, a total of 19+N bytes, N is the number of holding registers, and the start character and terminator are excluded during LRC calculation.

3. Return message format

insert image description here

The more detailed format is as follows:
start character + slave station address + function code + register start address high + register start address low + register quantity high byte + register quantity low byte + LRC + terminator, a total of 17 bytes, Among them, the start character and the end character are excluded during LRC calculation.

4. Case

Slave address: 1
Holding register start address: 0
Number of registers: 2
Assume that the slave

Guess you like

Origin blog.csdn.net/qq_34059233/article/details/131861000