Hach sc100 User Manual page 51

Table of Contents

Advertisement

Appendix A Modbus Protocol
A.1 Introduction
Address
1 byte
A.2 Query Message
Address
01
A.3 Response Message
Address
01
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:
Function
1 byte
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.
Function
02
Note that the above values are hexadecimal bytes, not ASCII characters.
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).
Function
02
Again note that the above values are hexadecimal bytes, not ASCII characters.
Data
Variable number of bytes
Data
Start Register
Number of Points
00 00
Data
Byte Count
Digital Input Bits
01
Checksum
2 bytes
Checksum
00 02
F9 CB
Checksum
02
20 49
51

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents