51
Appendix A Modbus Protocol
A.1 Introduction
Modbus was developed as a PLC communication protocol by Modicon in the late 1970s.
Because Modbus is a well-defined and published standard, Modbus has become one of
the best known protocols for interfacing digital equipment to PLCs.
Modbus uses a master/slave data exchange technique. The master (typically a PLC)
generates queries to individual slaves. The slaves, in turn, reply back with a response to
the master. A Modbus message contains the information required to send a query or
request, including the slave address, function code, data, and a checksum.
The format of a Modbus message is shown below:
A.2 Query Message
A query message is generated by the master to request data from a slave. It contains a
function code that specifies the type and amount of data requested. A read digital input
register function code (02), for example, instructs the slave to read digital inputs and return
the value in a response message.
The following message instructs slave 1 to read two bits starting at offset 0.
Note that the above values are hexadecimal bytes, not ASCII characters.
A.3 Response Message
A response message is generated by the slave in response to a query message from the
master. The response to read digital input register function code (02), for example, returns
the value of the requested digital inputs. The original slave address and function code is
also returned to validate the response.
The following response is generated from the previous query if discrete input 1 is OFF (0)
and discrete input 2 is ON (1).
Again note that the above values are hexadecimal bytes, not ASCII characters.
Address
Function
Data
Checksum
1 byte
1 byte
Variable number of bytes
2 bytes
Address
Function
Data
Checksum
Start Register
Number of Points
01
02
00 00
00 02
F9 CB
Address
Function
Data
Checksum
Byte Count
Digital Input Bits
01
02
01
02
20 49
Summary of Contents for sc100
Page 2: ...Visit http www hach com...
Page 6: ...Visit us at www hach com...
Page 8: ...Visit us at www hach com...
Page 28: ...Visit us at www hach com...
Page 44: ...Visit us at www hach com...
Page 50: ...Visit us at www hach com...
Page 62: ...Visit us at www hach com...
Page 64: ...Visit us at www hach com...