
Communication via Modbus TCP/IP
102
2.13.2018
14. Communication via Modbus TCP/IP
14.1. Datatypes
14.1.1. Used Datatypes
The
-Modbus protocol uses the following datatypes:
Datatype
Description
Number of used registers
short
signed value with 16 bits
1
ushort
unsigned value with 16 bits
1
int
signed value with 32 bits
2
uint
unsigned value with 32 bits
2
float
floating point value with 32 bits
2
Table 1: Datatypes
The data types of the several values are listed in the parameter description tables (
14.1.2. Data Encoding
MODBUS uses 16 bit registers for data transaction. Therefore, data values, which have more than 16 bit (float,
int, uint) need to be divided into two (or more) contiguous registers. According to the MODBUS specification,
these data values are encoded with the HIGH-WORD in the first and the LOW-WORD in the second register.
It is absolutely required that the complete bus system uses the same format so that all data is decoded correctly.
Some masters use the so called INTEL format (LOW-WORD first, HIGH-WORD second).
Therefore you can change the data encoding between INTEL format and MODBUS format by using holding-
register 93.
Floats are encoded in IEEE754 format (1Bit Sign, 8Bits Exponent, 23Bits Mantissa).
14.2. Error Handling
If the unit detects an illegal data frame, it responses with an exception response. The following exception
responses are supported by the unit.
Code
Name
Description
01
ILLEGAL FUNCTION
The function code received is not supported by the unit.
Attempt to change any parameter and the unit is not in remote
control.
02
ILLEGAL DATA ADDRESS
The data address received in the query is not an allowable address
for the unit (see register tables below).
The combination of data address and data length is not allowed for
the unit. (e.g. only the first or only the second register on an multi-
register value is set).
The register cannot be changed.
03
ILLEGAL DATA VALUE
The adjusted value is not in the allowed range for the unit.
Table 2: Exception-Codes