Read Holding Register (Function 3)

The Read Holding Register function can be used to read the input and output words and the registers. The inputs have offsets 0 - 0xFF while the outputs have offsets 0x800 - 0x8FF.

The first two analog outputs are read in this example. The analog outputs begin at offset 0x800. The length indicates the number of channels to be read.

Query

Byte Name

Sample

 

Start - Frame

":"

0x3A

Address

11

0x0B

"0B"

0x30, 0x42

Function-Code

3

0x03

"03"

0x30, 0x33

Start address high

8

0x08

"08"

0x30, 0x38

Start address low

0

0x00

"00"

0x30, 0x30

Count high

0

0x00

"00"

0x30, 0x30

Count low

2

0x02

"02"

0x30, 0x32

Error Check, LRC/CRC

 

0xC6, 0xC1 

"E8"

0x45, 0x38

End - Frame

 

t1-t2-t3

CRLF

0x0D, 0x0A

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

 

Start - Frame

":"

0x3A

Address

11

0x0B

"0B"

0x30, 0x42

Function-Code

3

0x03

"03"

0x30, 0x33

Byte Count

4

0x04

"04"

0x30, 0x34

Data 1 High-Byte

63

0x3F

"3F"

0x33, 0x46

Data 1 Low-Byte

255

0xFF

"FF"

0x46, 0x46

Data 2 High-Byte

0

0x00

"00"

0x30, 0x30

Data 2 Low-Byte

0

0x00

"00"

0x30, 0x30

Error Check, LRC/CRC

 

0xC6, 0xC1 

"B0"

0x42, 0x30

End - Frame

 

t1-t2-t3

CRLF

0x0D, 0x0A