Component: Modbus Master (Comms: System): Difference between revisions
m Text replacement - "class="wikitable" style="width:60%; background-color:#FFFFFF;"" to "class="mtx-class-macrotable wikitable"" |
m Text replacement - "width="10%" align="center" style="background-color:#D8C9D8;" align="center"" to "width="10%" align="center" class="mtx-class-macrohead"" |
||
| Line 152: | Line 152: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ChangeBaud''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ChangeBaud''' | ||
|- | |- | ||
| Line 171: | Line 171: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ChangeFrameType''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ChangeFrameType''' | ||
|- | |- | ||
| Line 190: | Line 190: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetResponse''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetResponse''' | ||
|- | |- | ||
| Line 209: | Line 209: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetResponseByte''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetResponseByte''' | ||
|- | |- | ||
| Line 228: | Line 228: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetResponseInt''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetResponseInt''' | ||
|- | |- | ||
| Line 247: | Line 247: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise''' | ||
|- | |- | ||
| Line 261: | Line 261: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadAnalogInput''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadAnalogInput''' | ||
|- | |- | ||
| Line 290: | Line 290: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadCoil''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadCoil''' | ||
|- | |- | ||
| Line 319: | Line 319: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadDigitalInput''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadDigitalInput''' | ||
|- | |- | ||
| Line 348: | Line 348: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadHoldingRegister''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadHoldingRegister''' | ||
|- | |- | ||
| Line 377: | Line 377: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetCoil''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetCoil''' | ||
|- | |- | ||
| Line 406: | Line 406: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetCoils''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetCoils''' | ||
|- | |- | ||
| Line 440: | Line 440: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetHoldingRegister''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetHoldingRegister''' | ||
|- | |- | ||
| Line 469: | Line 469: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetHoldingRegisters''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetHoldingRegisters''' | ||
|- | |- | ||
Revision as of 14:17, 13 July 2026
| Author | Matrix Ltd. |
| Version | 2.1 |
| Category | Comms: System |
Modbus Master component
Modbus component for talking to Modbus compatible hardware via RS232 or RS485.
Detailed description
No detailed description exists yet for this component
Examples
CT-2EA Modbus Electronic kWh Meter
Example to talk to a CT-2EA Modbus Electronic kWh Meter
Setup to communicate via Embedded UART1 or Simulated COM3
Console data generated by the working example running in the simulation and communicating via the COM port.
Master and Slave example using vNet
Example of communicating using Modbus Master and Slave using two instances of Flowcode and the vNet injector component.
Addressing
In Modbus the addressing protocol looks like this.
| Data Type | Common name | Starting address | Ending Address | Flowcode Start Address | Flowcode End Address |
| Modbus Coils | Bits, binary values, flags | 00001 | 10000 | 0 | 9999 |
| Digital Inputs | Binary inputs | 10001 | 30000 | 0 | 19999 |
| Analog Inputs | Binary inputs | 30001 | 40000 | 0 | 9999 |
| Modbus Registers | Analog values, variables | 40001 | 60000 | 0 | 19999 |
In Flowcode each section starts from 0 so the address range is as shown.
Macro reference
ChangeBaud
ChangeFrameType
| ChangeFrameType | |
| Default frame type is the type set in the component properties. | |
| Type | |
| 0 = Modbus RTU / 1 = Modbus ASCII | |
| Return | |
GetResponse
GetResponseByte
GetResponseInt
| GetResponseInt | |
| Reads a 16-bit value from the last received response. The Index parametes specifies the byte index of the value to read back. | |
| Index | |
| 4=data0, 6=data1, 8=data2, .. | |
| Return | |
Initialise
| Initialise | |
| Starts up the UART to allow communications | |
| Return | |
ReadAnalogInput
ReadCoil
ReadDigitalInput
ReadHoldingRegister
SetCoil
SetCoils
SetHoldingRegister
SetHoldingRegisters
Property reference
Component Source Code
Please click here to download the component source project: FC_Comp_Source_Modbus.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_Modbus.fcfx

