Figure 7: Master slave query response cycle [ref.
5]
One must not confuse the message frame with the data frame of a single byte (RTU
Mode) or 7- bit character (ASCII Mode). The structure of the data frame depends on the
transmission mode (ASCII or RTU). Note that on some other network types and on Modbus Plus,
the network protocol handles the framing of messages and uses start and end delimiters specific
to the network.
4.5 Modbus Addresses
The master device addresses a specific slave device by placing the 8-bit slave address in the
address field of the message (RTU Mode). The address field of the message frame contains two
characters (in ASCII mode), or 8 binary bits (in RTU Mode). Valid addresses are from 1-247.
When the slave responds, it places its own address in this field of its response to let the master
know which slave is responding.
4.6 Modbus Functions
The function code field of the message frame will contain two characters (in ASCII mode), or 8
binary bits (in RTU Mode) that tell the slave what kind of action to take. Valid function codes are
from 1-255, but not all codes will apply to a module and some codes are reserved for future use.
4.7 Modbus Data Field
The data field provides the slave with any additional information required by the slave to complete
the action specified by the function code. The data is formed from a multiple of character bytes (a
pair of ASCII characters in ASCII Mode), or a multiple of two hex digits in RTU mode, in range
00H-FFH. The data field typically includes register addresses; count values, and written data.
If no error occurs, the data field of a response from a slave will return the requested data.
If an error occurs, the data field returns an exception code that the master s application
software can use to determine the next action to take.
4.8 Modbus Error Checking
Modbus networks employ two methods of error checking: parity checking
1. Parity checking of the data character frame (even, odd, or no parity)
2. Frame checking within the message frame (Cyclical Redundancy Check in RTU Mode, or
Longitudinal Redundancy Check in ASCII Mode)
4.9 Modbus Exceptions
If an unsupported function code is sent to a module, then the exception code 01 (Illegal function)
will be returned in the data field of the response message. If a holding register is written with an
invalid value, then exception code 03 (Illegal Data Value) will be returned in the response
message.
11