SMAX MODBUS®
6.4 Function codes
As previously stated, the function code indicates to the Server what kind of
action to perform. The function code field of a Modbus data unit is coded in one
byte. Valid codes are in the range of 1 … 255 decimal (the range 128 … 255 is
reserved and used for Exception Responses). When a message is sent from a
Client to a Server device the function code field tells the Server what king of
action to perform. Function code “0” is not valid.
There are three categories of Modbus function codes, they are:
public function
codes
,
user-defined function codes
and
reserved function codes
.
Public function codes
are in the range 1 ... 64, 73 ... 99 and 111 ... 127; they are
well defined function codes, validated by the MODBUS-IDA.org community and
publicly documented; furthermore they are guaranteed to be unique. Ranges of
function codes from 65 to 72 and from 100 to 110 are
user-defined function
codes
: user can select and implement a function code that is not supported by
the specification, it is clear that there is no guarantee that the use of the
selected function code will be unique.
Reserved function codes
are not
available for public use.
6.4.1 Implemented function codes
Lika SMAX Modbus series linear encoders only implement public function codes,
they are described hereafter.
03 Read Holding Registers
FC = 03 (03 hex) ro
This function code is used to READ the contents of a contiguous block of
holding registers in a remote device; in other words, it allows to read the values
set in a group of work parameters placed in order. The Request PDU specifies the
starting register address and the number of registers. In the PDU registers are
addressed starting at zero. Therefore registers numbered 1-16 are addressed as
0-15.
The register data in the response message are packed as two bytes per register,
with the binary contents right justified within each byte. For each register, the
first byte contains the high order bits (msb) and the second contains the low
order bits (lsb).
For the complete list of holding registers accessible using
function code please refer to the “7.1.1 Machine data parameters
(Holding registers)” section on page 59.
Request PDU
Function code
1 byte
03 hex
Starting address
2 bytes
0000 hex to FFFF hex
Quantity of registers
2 bytes
1 to 125 (007D hex)
MAN SMAX MB E 1.2
Modbus® interface
49 of 84