modbus
vacon
• 19
24-hour s358 (0)40 8371 150 • Email: vacon@vacon.com
6
6.
MODBUS
6.1
Modbus RTU protocol, introduction
The MODBUS protocol is an industrial communications and distributed control system to integrate
PLCs, computers, terminals, and other monitoring, sensing, and control devices. MODBUS is a Mas-
ter-Slave communications protocol. The Master controls all serial activity by selectively polling one or
more slave devices. The protocol provides for one master device and up to 247 slave devices on a
common line. Each device is assigned an address to distinguish it from all other connected devices.
The MODBUS protocol uses the master-slave technique, in which only one device (the master) can
initiate a transaction. The other devices (the slaves) respond by supplying the request data to the
master, or by taking the action requested in the query. The master can address individual slaves or
initiate a broadcast message to all slaves. Slaves return a message (‘response’) to queries that are
addressed to them individually. Responses are not returned to broadcast queries from the master.
A transaction comprises a single query and single response frame or a single broadcast frame. The
transaction frames are defined below.
Master's
message
Slave
response
START
START
ADDRESS
ADDRESS
FUNCTION
FUNCTION
DATA
DATA
CRC
CRC
END
END
Figure 13. The basic structure of a Modbus frame
Valid slave device addresses are in the range of 0 ... 247 decimal. The individual slave devices are as-
signed addresses in the range of 1 ... 247. A master addresses a slave by placing the slave address in
the address field of the message. When the slave sends its response, it places its own address in this
address field of the response to let the master know which slave is responding.
The function code field of a message frame contains two characters (ASCII) or eight bits (RTU). Valid
codes are in the range of 1 ... 255 decimal. When a message is sent from a master to a slave device
the function code field tells the slave what kind of action to perform. Examples are to read the ON /
OFF states of a group of discrete coils or inputs; to read the data contents of a group of registers; to