Read or Write Registers (Function 23)

A number of analog outputs can be written and a number of analog inputs read with one telegram using the Read / Wrrite Registers function. In this example the first two analog output words are written, and the first two analog inputs are read. The analog outputs start at offset 0x0800, while the inputs start at offset 0x0000. Here the offset always describes a word. Offset 0x0003 writes to the fourth word in the output process image. The length indicates the number of words, and the Byte count is formed from the combination of all the bytes that are to be written. Example: 4 words – correspond to a byte count of 8

The data bytes contain the values for the analog outputs. In this example, two words are to be written. The first word is to receive the value 0x3FFF, and the second word is to receive the value 0x7FFF.

Query

Byte Name

Example

Function code

23

Read start address high

0

Read start address low

0

Read length high

0

Read length low

2

Write start address high

8

Write start address low

0

Write length high

0

Write length low

2

Byte Count

4

Data 1 high

63

Data 1 low

255

Data 2 high

127

Data 2 low

255

Response

The coupler replies with the start address and the length of the bytes to be transferred in Byte count. The data information follows. In this example the first word contains 0x0038 while the second word contains 0x3F0B.

Byte Name

Example

Function code

23

Byte Count

4

Data 1 high

0

Data 1 low

56

Data 2 high

63

Data 2 low

11