beautypg.com

The query-response cycle, The query, The response – Watlow CLS200, MLS300 and CAS200 User Manual

Page 28: Serial transmission, Coding system, Bits per byte, The query-response cycle serial transmission

background image

22 Communications Specification

Chapter 2: Modbus-RTU Protocol

The Query-Response Cycle

The Query

The function code in the query tells the addressed slave device what
kind of action to perform. The data bytes contain any additional
information that the slave will need to perform the function. For
example, function code 03 will query the slave to read holding registers
and respond with their contents. The data field must contain the
information telling the slave which register to start at and how many
registers to read. The error check field provides a method for the slave to
validate the integrity of the message contents.

The Response

If the slave makes a normal response, the function code in the response
is an echo of the function code in the query. The data bytes contain the
data collected by the slave, such as register values or status. If an error
occurs, the function code is modified to indicate that the response is an
error response, and the data bytes contain a code that describes the error.
The error check field allows the master to confirm that the message
contents are valid.

Serial Transmission

Each 8-bit byte in a message contains two 4-bit hexadecimal characters.
This high character density allows better data throughput than ASCII for
the same baud rate. Each message must be transmitted in a continuous
stream.

Coding System

8-bit binary, hexadecimal 0 to 9, A to F

2 hexadecimal characters contained in each 8-bit field of the message

Bits per Byte

1 start bit

Device Address

Function Code

8-Bit
Data Bytes

Error Check

Query Message from Master

Response Message from Slave

Device Address

Function Code

8-Bit
Data Bytes

Error Check