Read holding register (Function 3)
The Read holding register function can be used to read the input and output words and the registers. Inputs from offset 0 - 0xFF and outputs from offset 0x800 - 0x8FF, and for controllers (BC, BX) the flag area from offset 0x4000.
In this example the first two analog outputs (or two output words) are read. The analog outputs (or output words) start at offset 0x800. The length indicates the number of channels (or words) to be read.
Query
Byte Name |
Sample |
---|---|
Function code |
3 |
Start address high |
8 |
Start address low |
0 |
Count high |
0 |
Count low |
2 |
The fieldbus coupler answers with byte count 4, i.e. 4 bytes of data are returned. The query was for two analog channels, and these are distributed over two words. In the analog output process image, the first channel has the value 0x3FFF, while the second channel has the value 0x0.
Response
Byte Name |
Sample |
---|---|
Function code |
3 |
Byte Count |
4 |
Data 1 high byte |
63 |
Data 1 low byte |
255 |
Data 2 high byte |
0 |
Data 2 low byte |
0 |