MULTI GAUGE CONTROLLER COMMUNICATION
6.4.5 FUNCTION CODES
The function codes have 1-byte length. These are instructions for Slave devices describing action
to be executed.
The following function codes are supported through the MG15 device.
FUNCTION CODE FUNCTION
0x03 Read n-words
0x06 Write word
0x10 Write n-words
Table 6.8: Modbus protocol function codes
It is recommended to use the 0x03 function to read data, and the 0x10 function to write. It applies
also to logic data. Other function codes are supported to ensure compatibility with the Modbus
documentation. Exchange of information between the Master and Slave devices is executed through
data words. These data consist of parameters. The deinitions of individual words for the MG15 are
presented in tables, starting from ??.
Communication frame formats for individual function codes are described below.
6.4.5.1 0x03 - READ N-WORDS
It enables sequential reading of a number of parameters within one query.
It is necessary to deine the address of the irst parameter and number of words to be read after
this address.
Query:
Device
address
Function
code 0x03
First word address Number of words to
read
CRC
1 byte 1 byte MSB LSB MSB LSB MSB LSB
The maximum number of read words is 125. The irst two bytes are the data for the irst parameter
(irst MSB in organisation). The subsequent byte pairs are the data for the following parameters.
Response:
Device
address
Function
code 0x03
Number of
read bytes
Value of irst
word
... Value of
last word
CRC
1 byte 1 byte 1 byte MSB LSB ... MSB LSB MSB
LSB
Example: Read 3 words from address 0x0000.
Query:
TX: 01 03 00 00 00 03 05 CB
Response:
RX: 01 03 06 3A 83 12 6F 00 00 54 94
Received data: 3A 83 12 6F 00 00
User manual rev. 03 Page 95