Hach sc100 User Manual page 52

Table of Contents

Advertisement

Modbus Protocol
A.4 Modbus Message Detail
Function Code
03
Read Holding Registers
06
Write Holding Register
08
Loopback Test
17
Report Slave ID
Address
01
Colon
Address
3A
30 31
52
The various fields within a Modbus message are described in more detail below.
Address
The address field is a single byte. This byte ranges in value from 1 to 247.
Function Codes
The function code is a single byte. Several function code values exist in Modbus. The ones
supported by the sc100/Digital Sensor System are described below.
Description
Only the relative address is specified in a message. The relative address is automatically
added to the absolute address for that function code. If a read holding register message,
for example, specifies relative address 0, the value in absolute address 40001 would be
returned.
Data
The data field consists of a series of bytes. The number of bytes varies in length
depending on the function code. Typical query message data consists of the relative
address to be read by the slave. Typical response message data consists of actual data
read by the slave.
Checksum
The checksum is two bytes which are appended to every message. These bytes ensure
the data packet was transmitted with no errors. The algorithm which is applied to RTU
messages is a 16 bit Cyclic Redundancy Check (CRC). The algorithm which is applied to
ASCII messages is an 8 bit Longitudinal Redundancy Check (LRC).
ASCII / RTU Data Format
Modbus supports both ASCII and RTU data formats. RTU uses binary (non-printable)
characters, and is used for normal operation. ASCII uses 7 bit printable characters, and is
typically only used for debugging purposes.
The following tables show the same message in RTU and ASCII formats.
Table 8 RTU Message
Function
02
Table 9 ASCII Message
Function
Start Register
30 32
30 30 30 30
Data Type
Absolute Address
Word (16 bits)
40001 to 49999
Word (16 bits)
40001 to 49999
n/a
n/a
Data
Start Register
Number of Points
00 00
Data
Number of Points
30 30 30 32
Relative Address
0 to 9998
0 to 9998
n/a
n/a
n/a
n/a
Checksum
00 02
F9 CB
Checksum
46 42
CR LF
0D 0A

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents