Industrial
Electronic Devices
ADFweb.com S.r.l.
User Manual
Modbus Master / MQTT
Document code: MN67933_ENG Revision 1.101 Page 39 of 45
Example
We have defined 3 rows in the “Modbus Set Access” table in this way:
Row1
: ID: 1, Type: Holding Register, Address: 100, NPoint: 2
Row2
: ID: 2, Type: Coil Status, Address: 200, NPoint: 10
Row3
: ID: 1, Type: Input register, Address: 300, NPoint: 1
We define a template string in this way:
Modbus ID: $SOURCE$, Function Code: $FC$, Modbus register: $ADDRESS$, Num. of Registers: $NPOINT$, Data: $VALUE$
The output of MQTT will be:
Row 1
Modbus ID: 1, Function Code: 3, Modbus register: 100, Num. of Registers: 2, Data: XXXX
Row 2
Modbus ID: 2, Function Code: 1, Modbus register: 200, Num. of Registers: 10, Data: XXXX
Row 3
Modbus ID: 1, Function Code: 4, Modbus register: 300, Num. of Registers: 1, Data: XXXX
It is also possible to define the template as JSON format, like this:
{
"id": "$SOURCE$",
"fc": "$FC$",
"address": "$ADDRESS$",
"npoint": "$NPOINT$",
"data": "$VALUE$"
}