beautypg.com

5 rtu framing examples, 1 read registers (function code 0x03 & 0x04), Rtu framing examples – Emerson MONITORING OpenComms User Manual

Page 30: Read registers (function code 0x03 & 0x04), Write single holding register (function code 0x06)

background image

Modbus Communications and Connectivity

24

the OpenComms NIC module primarily uses Function Code 3 (Read

Holding Registers) and Function Code 6 (Preset Single Register).
Data Field(s)
The data field varies in length depending on whether the message is a

request or a response to a packet. This field typically contains infor-

mation required by the slave device to perform the command specified

or to pass back data to the master device.
Error Check Field
The Error Check Field consists of a 16-bit (2 byte) Cyclical Redun-

dancy Check (CRC16). It allows the receiving device to detect a packet

that has been corrupted with transmission errors.

5.5

RTU Framing Examples

5.5.1 Read Registers (Function Code 0x03 & 0x04)

Query: for reading holding /input registers (requested by a client)

Response: for reading holding/input registers (response by the

server)

5.5.2 Write single holding register (Function Code 0x06)

Query: for writing a single holding register (requested by a client)

Response: for writing a holding registers (response by the server)

Server

Address

Function Code

(0x3/0x4)

Index of

starting register

Number of

registers to

be read

16 bit

CRC

1 byte

1 byte

2 bytes

2 bytes

2 bytes

Server

Address

Function Code

(0x3/0x4)

Byte

Count

Data from

registers

16 bit

CRC

1 byte

1 byte

1 byte

2*m bytes (= Byte Count)

2 bytes

Server

Address

Function Code

(0x06)

Index of

the register

16 bit value

to be written

16 bit

CRC

1 byte

1 byte

2 bytes

2 bytes

2 bytes

Server

Address

Function Code

(0x06)

Index of

the register

16 bit value

been written

16 bit

CRC

1 byte

1 byte

2 bytes

2 bytes

2 bytes