6handling of large data types – KROHNE OPTISONIC V6 Modbus User Manual
Page 12
2011-07-19
OPTISONIC_V6_Modbus_6.doc
12/29
K
R
O
H
N
E
C
T
P
ro
d
u
c
ts
6
HANDLING OF LARGE DATA TYPES
The standard Modbus specification does not explain how data types larger than 16 bits should be handled.
As larger data types are stored in a multiple of 16 bit registers, such data can be accessed by means of
“read” or “write” operation on a series of consecutive 16 bit registers.
Function 03 (read multiple holding registers), function 04 (read input registers), function 06 (write single
holding register), and function 16 (write multiple holding registers) are used to read or modify these data
types.
Taking the data type into account, the addressing can be “optimized” accordingly, this is implemented in an
addressing mode not compatible with the original Modicon concept:
•
In the original “Modicon compatible mode” one address is assigned and counted for each 16 bit
register. To hold for example a 64-bit integer value, 4 addresses would be occupied. Therefore, in
order to address the next variable of this type, the address has to be incremented by 4.
•
In “not-Modicon compatible mode” addresses are incremented by 1 for each next variable. For
example, in order to read or write the next 64-bit variable, the register area to be read will
automatically be shifted by 4 16 bit registers.
The OPTISONIC V6 is by default configured for Modicon compatible addressing.
The supported data types are:
•
Integer (16 bit)
•
Long integer (32 bit)
•
Float (single precision floating-point, 32 bit)
•
Double (double precision floating-point, 64 bit)
•
Long long (64-bit Integer)
The register ranges for each data type:
Number of registers to request for each data type
Data type
Address range
Modicon compatible
Not Modicon compatible
Integer (16 bit)
3000..3999
1
1
Long integer (32 bit)
5000..5999
2
1
Double (64 bit)
6000..6999
4
1
Float (32 bit)
7000..7999
2
1
Long long (64 bit)
8000..8999
4
1
Note that in
Modicon compatible mode
each data type larger than 16 bits should be addressed as an
appropriate number of 16-bit registers. For instance the first float is located at address 7000/7001; the next
float is located at address 7002/7003.
A double would be accessed by four 16-bit registers, so the first double 6000/6001/6002/6003 and the next
double 6004/6005/6006/6007.
The data in the chapter 8, “MODBUS REGISTER MAPPING”, is printed both as it should be addressed in
Modicon compatible and as well as in
not-Modicon compatible mode
.
6.1
Integer (16 bit), Transmit Sequence
Integers
are transmitted and stored with the most significant part first.
Example
Integer value 1790 decimal (6FE hexadecimal) is transmitted as:
First transmitted byte in data field
Second transmitted byte in data field
06
FE