Information Technology Reference
In-Depth Information
18
Modbus
18.1 Modbus protocol
The Modbus protocol is an industry-standard protocol which allows programmable control-
lers to communicate over a network or local communications link. It defines a standard mes-
sage structure that all Modbus-compatible controllers recognise and implement, regardless of
the network type. It describes:
The format of requests to Modbus-compatible devices.
The format of responses from Modbus-compatible devices.
The layout and contents of message fields for Modbus-compatible devices. The Modbus
protocol provides the internal standard that the Modicon controllers use for parsing mes-
sages.
How each controller knows its own device address and recognizes any messages ad-
dressed to it.
The format of the data and other information contained in the message.
18.1.1 Transactions on Modbus networks
Standard Modbus controllers communicate using RS-232C and can be networked or con-
nected via a modem. Each controller (such as a host processor) communicates with the con-
nected devices (such as a PLC) using a master-slave technique (Figure 18.1). The controller
(the master) initiates transactions (queries) which are sent to the other devices (the slaves).
The addressed slave then responses to the request by sending back data or by implementing
the required action. This addressing can be to an individual device, or can be broadcasted to
all connected slaves. There are no responses from a broadcast query.
The query takes the form of:
An address (either an individual address or a broadcast address).
A function code, which defines the requested action.
Sent data, the format of which depends on the function code. For example, a function
code of 03 defines that the slave read from the started register defined in the data field
and it also contains the number of registers to read.
Error-checking field, to allow the slave to validate the message integrity.
The response message takes the form:
Action confirmation - on error, this field contains an echo of the query function code.
On an error, the function code is modified to indicate that the response is an error re-
sponse, and the returned data field contains an error code.
Search WWH ::




Custom Search