8
…4
MODBUS PROTOCOL
4.2
MODBUS Function Codes
The function code instructs the addressed slave which function to perform.
Table 4.1 shows the function codes, and describes the action they initiate.
*NAK = Negative Acknowledgment
Table 4.1 MODBUS Function Codes
Function
Code
Function
Title
Description
01
Read
Coil Status
Read up to 16 consecutive discrete (Boolean) points
from a specific starting point. The slave instrument
returns zeros for points which do not contain defined
data and NAKs* any request for point numbers
greater than 60.
Read up to 8 consecutive registers from a specific
starting register. The slave instrument returns zeros
for points which do not contain defined data and
NAKs* any request for point numbers greater than
90.
Write one discrete (Boolean) point. The slave
instrument NAKs* this if the point is not currently
writeable.
Write one register. This code also applies any
existing limits to the register before storage in the
instrument. The slave instrument NAKs* if the
register is not currently writeable.
Echo the message. Only ‘Return of Query’ is
supported.
Write up to eight consecutive registers from a
specified starting register. The slave instrument
NAKs* if any of the registers are not currently
writeable, but carries out all the writes which are
valid, applying any existing limits to the value before
storage in the instrument.
03
Read
Holding Register
05
Force
Single Coil
06
Preset
Single Register
08
Loop Back
16
Preset
Multiple
Registers