KROHNE OPTISONIC V6 Modbus User Manual
Page 11
2011-07-19
OPTISONIC_V6_Modbus_6.doc
11/29
K
R
O
H
N
E
C
T
P
ro
d
u
c
ts
Example
An example of a request for slave device 17 to pre-set two registers starting at 40002 (decimal), 9C42
(hexadecimal) to 00 0A end 01 02 hex:
Starting
address
Quantity
Registers
Byte
counts
Data
Header
--
Slave
Address
11(h)
Func-
tion
10(h)
Hi
9C(h)
Low
41(h)
Hi
00(h)
Low
02(h)
04(h)
Hi
00(h)
Low
0A(h)
Hi
01(h)
Low
02(h)
Error
check
--
Trailer
--
Response
The normal response returns the slave address, the function code, starting address, and quantity of registers
pre-set:
Starting
Address
Quantity
Of points
Header
--
Slave
Address
11(h)
Function
10(h)
Hi
9C(h)
Low
41(h)
Hi
00(h)
Low
02(h)
Error
check
--
Trailer
--
If the request is not applicable, an exception response will be sent.
See chapter
5.10
for exception
responses
.
5.10 Exception Responses
Except for broadcast messages, a master device expects a normal response, when it sends a request to a
slave device. One of the four possible events can occur upon the master device’s request:
•
If the slave device receives the request without a communication error and can handle the request
normally, it returns a normal response.
•
If the slave does not receive the request due to a communication error, no response is returned. The
master program will eventually process a timeout condition for the request.
•
If the slave receives the request, but detects a communication error (parity, CRC, LRC), no response
is returned. The master program will eventually process a timeout condition for the request.
•
If the slave receives the request without a communication error, but cannot handle it, the slave will
return an exception response informing the master of the nature of the error.
The exception response message has two fields that differentiate it from a normal response.
Function Code Field
In a normal response the slave echoes the function code of the original request in the function code field of
the response. In an exception response the slave sets the most significant bit of the function code to 1.
The master recognises the exception response by means of this bit and can examine the data field for the
exception code.
Data field
In an exception response the slave returns an exception code in the data field. By means of this exception
code the slave reports a reason for not being able to respond normally.
The exception response message:
Header
Slave address
Function
Exception code
Error check
Trailer
Exception codes
Code
Name
Meaning
01
Illegal function
The function code in the request is not an allowable action for the slave.
02
Illegal data address
The data address received in the request is not an allowable address for the
slave.