5 supported functions – KROHNE ALTOSONIC V Modbus EN User Manual
Page 10
ALTOSONIC V
ModBus Manual 0300 rev07 E
7.30855.35.00
Page 10 of 64
5 SUPPORTED FUNCTIONS
All data addresses in Modbus messages are referenced to zero.
For example:
•
Coil 1 is addressed as Coil 0000.
•
Holding register 40001 is addressed as 0000. Note that the function code specifies the operation of
a ‘holding register’, therefore the 4xxxx reference is implicit.
When functions which do not support broadcast requests, are accessed with a broadcast address, the
request will be rejected.
5.1
Function 01: READ COIL STATUS
Description
Function 1 reads the ON/OFF status of discrete inputs or discrete variables in the slave (0 x references
called coils).
Broadcast is not supported.
Query
The query specifies the starting coil and the quantity of coils to read.
The maximum number of coils requested each request is limited to 2000.
Example
Here is an example of a request to read coils 20-56 from slave device 17:
Starting address
Number of points
Header
--
Slave
Address
11(h)
Function
01(h)
Hi
00(h)
Low
13(h)
Hi
00(h)
Low
25(h)
Error check
--
Trailer
--
Response
Data
Header
--
Slave
address
11(h)
Function
01(h)
Byte
count
05(h)
Coil
27-20
CD(h)
Coil
35-28
6B(h)
Coil
43-36
B2(h)
Coil
51-44
0E(h)
Coil
56-52
1B(h)
Error check
--
Trailer
--
The coil status in the response message is packed as one coil per bit of the data field. Status is
indicated as 1= ON, 0= OFF.
The LSB of the first data byte contains the coil addressed in the query. The other coils follow toward
the high order end of this byte and from 'low order to high order' in subsequent bytes.
If the returned coil quantity is not a multiple of eight, the remaining bits in the final data byte will be
padded with zeros (toward the high order end of the byte). The Byte Count field specifies the quantity
of complete bytes of data.
The status of coils 27-20 is shown as the byte value CD hex, or binary 1100 1101.
Coil 27 is the MSB of this byte, and coil 20 is the LSB. Left to right, the status of coils 27 through 20 is
ON-ON-OFF-OFF-ON-ON-OFF-ON.
By convention, bits within a byte are shown with the MSB to the left, and the LSB to the right. Thus the
coils in the first byte are '27 through 20', from left to right, The next byte has coils '35 through 28', left to
right. As the bits are transmitted serially, they flow from LSB to MSB: 20…27, 28...35, and so on.
In the last data byte, the status of coils 56-52 is shown as the byte value 1B hex, or binary 0001 1011.
Coil 56 is in the fourth bit position from the left, and coil 52 is the LSB of this byte. The status of coils
56 through 52 is ON-ON-OFF-ON-ON.