Difference between revisions of "Component: Modbus Slave (Comms: System)"

From Flowcode Help
Jump to navigationJump to search
 
(21 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
+
{| style="width:50%"
 
 
{| width="50%"
 
 
|-
 
|-
| width="20%" style="color: gray;" | Author
+
| width="20%" style="color:gray;" | Author
 
| Matrix Ltd.
 
| Matrix Ltd.
 
|-
 
|-
| width="20%" style="color: gray;" | Version
+
| width="20%" style="color:gray;" | Version
| 1.2 (Release)
+
| 2.0
 
|-
 
|-
| width="20%" style="color: gray;" | Category
+
| width="20%" style="color:gray;" | Category
 
| Comms: System
 
| Comms: System
 
|}
 
|}
  
  
 
+
==Modbus Slave component==
==[[File:Component Icon 687f8ad4_59f2_4079_bb84_7713dcb57a13.png|Image]] Modbus Slave component==
 
 
Modbus component for creating Modbus compatible slave hardware via RS232 or RS485.  
 
Modbus component for creating Modbus compatible slave hardware via RS232 or RS485.  
  
==Examples==
+
==Component Source Code==
  
 +
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_ModbusSlave.fcfx FC_Comp_Source_ModbusSlave.fcfx]
  
Example master program to control the slave. The example reads the 8 switches connected to PortD. If the switch values change then the new value is send to the slave.
+
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_ModbusSlave.fcfx FC_Comp_Source_ModbusSlave.fcfx]
  
{{Fcfile|ModBus_Master_Example1.fcfx|Modbus Master Example}}
+
==Detailed description==
  
  
Example slave program to react to the signals from the master. The example listens for Modbus commands from the master and outputs the current coils 0-7 state to eight LEDs connected to PortD.
 
  
{{Fcfile|ModBus_Slave_Example1.fcfx|Modbus Slave Example}}
 
  
  
  
==Downloadable macro reference==
 
  
===<span style="font-weight: normal;"><u><tt>ReadHoldingRegister</tt></u></span>===
 
Reads the value of a single holding register.
 
  
'''Parameters'''
 
  
:[[Variable Types|UINT]] ''Address''
 
::Coil Address
 
  
  
'''Return value'''
 
  
:[[Variable Types|UINT]]
 
  
  
===<span style="font-weight: normal;"><u><tt>ReadCoilStates</tt></u></span>===
 
Reads the state of a single digital coil.
 
  
Can pack a max of 8-bits together in a single operation
 
  
'''Parameters'''
 
  
:[[Variable Types|UINT]] ''StartAddress''
 
::Coil Address Range 0 to (NumCoils - 1)
 
  
:[[Variable Types|BYTE]] ''AddressCount''
 
::Range 1-8
 
  
  
'''Return value'''
 
  
:[[Variable Types|BYTE]]
 
  
  
===<span style="font-weight: normal;"><u><tt>ReadAnalogueInput</tt></u></span>===
+
''No detailed description exists yet for this component''
Reads the value of a single analogue input.
 
  
'''Parameters'''
+
==Examples==
  
:[[Variable Types|UINT]] ''Address''
 
::Coil Address
 
  
  
'''Return value'''
 
  
:[[Variable Types|UINT]]
 
  
  
===<span style="font-weight: normal;"><u><tt>ReadInputStates</tt></u></span>===
 
Reads the state of a single digital input.
 
  
Can pack a max of 8-bits together in a single operation
 
  
'''Parameters'''
 
  
:[[Variable Types|UINT]] ''StartAddress''
 
::Coil Address Range 0 to (NumCoils - 1)
 
  
:[[Variable Types|BYTE]] ''AddressCount''
 
::Range 1-8
 
  
  
'''Return value'''
 
  
:[[Variable Types|BYTE]]
 
  
  
===<span style="font-weight: normal;"><u><tt>SetSlaveAddress</tt></u></span>===
 
Allows the slave address to be overridden from the default slave address specified
 
  
in the component property. The number of bytes used for the address is fixed by the
 
  
Slave ID Bytes property to save on RAM usage.
 
  
'''Parameters'''
 
  
:[[Variable Types|UINT]] ''SlaveAddress''
 
  
  
'''Return value'''
 
  
:''This call does not return a value''
 
  
  
===<span style="font-weight: normal;"><u><tt>SetCoilState</tt></u></span>===
 
Sets the state of a single digital coil.
 
  
'''Parameters'''
+
Example master program to control the slave. The example reads the 8 switches connected to PortD. If the switch values change then the new value is send to the slave.
  
:[[Variable Types|UINT]] ''Address''
+
{{Fcfile|ModBus_Master_Example1.fcfx|Modbus Master Example}}
::Coil Address
 
  
:[[Variable Types|BYTE]] ''State''
 
::0=off, 1=on
 
  
 +
Example slave program to react to the signals from the master. The example listens for Modbus commands from the master and outputs the current coils 0-7 state to eight LEDs connected to PortD.
  
'''Return value'''
+
{{Fcfile|ModBus_Slave_Example1.fcfx|Modbus Slave Example}}
  
:''This call does not return a value''
 
  
 +
===Master and Slave example using vNet===
  
===<span style="font-weight: normal;"><u><tt>SetInputState</tt></u></span>===
+
Example of communicating using Modbus Master and Slave using two instances of Flowcode and the vNet injector component.
Sets the state of a single digital input.
 
  
'''Parameters'''
+
{{Fcfile|ModbusMasterDemo.fcfx|ModbusMasterDemo}}
  
:[[Variable Types|UINT]] ''Address''
+
{{Fcfile|ModBusSlaveDemo.fcfx|ModBusSlaveDemo}}
::Coil Address
 
  
:[[Variable Types|BYTE]] ''State''
 
::0=off, 1=on
 
  
 +
===Addressing===
  
'''Return value'''
+
In Modbus the addressing protocol looks like this.
  
:''This call does not return a value''
+
{| width="80%"
 +
|'''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
 +
|}
  
  
===<span style="font-weight: normal;"><u><tt>SetBaudRate</tt></u></span>===
+
In Flowcode each section starts from 0 so the address range is as shown.
Allows the Baud Rate to be controlled dynamically overriding the default
 
  
rate specified by the Baud component property.
 
  
'''Parameters'''
 
  
:[[Variable Types|BYTE]] ''Rate''
 
::0=1200, 1=2400, 2=4800, 3=9600, 4=19200, 5=38400, 6=57600, 7=115200
 
  
  
'''Return value'''
 
  
:''This call does not return a value''
 
  
  
===<span style="font-weight: normal;"><u><tt>SetHoldingRegister</tt></u></span>===
 
Sets the state of a single holding register.
 
  
'''Parameters'''
 
  
:[[Variable Types|UINT]] ''Address''
 
::Coil Address
 
  
:[[Variable Types|UINT]] ''Value''
+
==Macro reference==
::Analogue Value range 0 - 65535
 
  
 +
===ChangeBaud===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ChangeBaud'''
 +
|-
 +
| colspan="2" | Changes the UART Baud rate. 1 = 1200 / 2 = 2400 / 3 = 4800 / 4 = 9600 / 5 = 19200 / 6 = 31250 7 = 38400 / 8 = 57600 / 9 = 115200&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Baud
 +
|-
 +
| colspan="2" | The new baud rate (0=1200, 9=115200)&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Return value'''
 
  
:''This call does not return a value''
+
===ChangeFrameType===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ChangeFrameType'''
 +
|-
 +
| colspan="2" | Default frame type is the type set in the component properties.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Type
 +
|-
 +
| colspan="2" | 0 = Modbus RTU / 1 = Modbus ASCII&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
===<span style="font-weight: normal;"><u><tt>CheckForIncoming</tt></u></span>===
+
===CheckForIncoming===
Checks for an incoming message and if the data address is within range then also automatically replies with the correct reply.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckForIncoming'''
 +
|-
 +
| colspan="2" | Checks for an incoming message and if the data address is within range then also automatically replies with the correct reply. Returns 0 if no comms received, 1 for a succesful transaction, 255 for an error.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
Returns 0 if no comms received, 1 for a succesful transaction, 255 for an error.
 
  
'''Parameters'''
+
===GetLastIncoming===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetLastIncoming'''
 +
|-
 +
| colspan="2" | Gets a value from the last incoming command. Index 0 = 0 Read / 1 Write Index 1 = 0 Coils / 1 DigInput / 2 AnInput / 3 Register Index 2 = Address  Index 3 = Number&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Index
 +
|-
 +
| colspan="2" | Range: 0-3&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:''This macro has no parameters''
 
  
 +
===Initialise===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 +
|-
 +
| colspan="2" | Starts up the UART to allow communications and initialises the states of the various  Modbus Coils, Inputs and Registers to 0.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Return value'''
 
  
:[[Variable Types|BYTE]]
+
===ReadAnalogInput===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadAnalogInput'''
 +
|-
 +
| colspan="2" | Reads the value of a single analogue input.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | Address
 +
|-
 +
| colspan="2" | Coil Address&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
===<span style="font-weight: normal;"><u><tt>SetAnalogueInput</tt></u></span>===
+
===ReadCoils===
Sets the state of a single analogue input.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadCoils'''
 +
|-
 +
| colspan="2" | Reads the state of up to eight digital coils. Can pack a max of 8-bits together in a single operation&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | StartAddress
 +
|-
 +
| colspan="2" | Coil Address Range 0 to (NumCoils - 1)&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | AddressCount
 +
|-
 +
| colspan="2" | Range 1-8&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Parameters'''
 
  
:[[Variable Types|UINT]] ''Address''
+
===ReadDigitalInputs===
::Coil Address
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadDigitalInputs'''
 +
|-
 +
| colspan="2" | Reads the state of up to eight digital inputs. Can pack a max of 8-bits together in a single operation&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | StartAddress
 +
|-
 +
| colspan="2" | Coil Address Range 0 to (NumCoils - 1)&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | AddressCount
 +
|-
 +
| colspan="2" | Range 1-8&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:[[Variable Types|UINT]] ''Value''
 
::Analogue Value range 0 - 65535
 
  
 +
===ReadHoldingRegister===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadHoldingRegister'''
 +
|-
 +
| colspan="2" | Reads the value of a single holding register.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | Address
 +
|-
 +
| colspan="2" | Coil Address&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Return value'''
 
  
:''This call does not return a value''
+
===SetAnalogInput===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetAnalogInput'''
 +
|-
 +
| colspan="2" | Sets the state of a single analogue input.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | Address
 +
|-
 +
| colspan="2" | Coil Address&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | Value
 +
|-
 +
| colspan="2" | Analogue Value range 0 - 65535&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
===<span style="font-weight: normal;"><u><tt>Initialise</tt></u></span>===
+
===SetBaudRate===
Starts up the UART to allow communications and initialises the states of the various
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetBaudRate'''
 +
|-
 +
| colspan="2" | Allows the Baud Rate to be controlled dynamically overriding the default  rate specified by the Baud component property.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Rate
 +
|-
 +
| colspan="2" | 0=1200, 1=2400, 2=4800, 3=9600, 4=19200, 5=38400, 6=57600, 7=115200&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
Modbus Coils, Inputs and Registers to 0.
 
  
'''Parameters'''
+
===SetCoil===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetCoil'''
 +
|-
 +
| colspan="2" | Sets the state of a single digital coil.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | Address
 +
|-
 +
| colspan="2" | Coil Address&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | State
 +
|-
 +
| colspan="2" | 0=off, 1=on&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:''This macro has no parameters''
 
  
 +
===SetDigitalInput===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetDigitalInput'''
 +
|-
 +
| colspan="2" | Sets the state of a single digital input.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | Address
 +
|-
 +
| colspan="2" | Coil Address&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | State
 +
|-
 +
| colspan="2" | 0=off, 1=on&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Return value'''
 
  
:''This call does not return a value''
+
===SetHoldingRegister===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetHoldingRegister'''
 +
|-
 +
| colspan="2" | Sets the state of a single holding register.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | Address
 +
|-
 +
| colspan="2" | Coil Address&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | Value
 +
|-
 +
| colspan="2" | Analogue Value range 0 - 65535&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
 
+
===SetSlaveAddress===
==Simulation macro reference==
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
+
|-
''This component does not contain any simulation macros''
+
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetSlaveAddress'''
 +
|-
 +
| colspan="2" | Allows the slave address to be overridden from the default slave address specified in the component property. The number of bytes used for the address is fixed by the Slave ID Bytes property to save on RAM usage.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | SlaveAddress
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
 
==Property reference==
 
==Property reference==
<span style="font-weight: normal;"><u>Channel</u></span>
 
  
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''CHANNEL''.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
+
|-
UART channel to specify an onboard hardware channel.
+
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
Software channels are not availlable as we rely on hardware UART RX interrupts to pull in the data
+
|-
 
+
|-
<span style="font-weight: normal;"><u>TX</u></span>
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | UART Properties
This property is of type ''Single digital pin'' and can be referenced with the variable name ''TX''.
+
|-
 
+
|-
UART transmit pin
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | Channel
<span style="font-weight: normal;"><u>RX</u></span>
+
|-
 
+
| colspan="2" | UART Channel selector Software channels are bit banged using generic I/O pins but are not as reliable as hardware channels. Hardware channels use the selected peripheral on-board the target microcontroller.&nbsp;
This property is of type ''Single digital pin'' and can be referenced with the variable name ''RX''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
UART receive pin
+
| width="90%" | TX
 
+
|-
<span style="font-weight: normal;"><u>Baud Rate</u></span>
+
| colspan="2" | Pin to be used for Transmit data&nbsp;
 
+
|-
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''BAUD_LIST''.
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
+
| width="90%" | RX
Data rate in bits per second
+
|-
 
+
| colspan="2" | Pin to be used for Receive data&nbsp;
<span style="font-weight: normal;"><u>Bus</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''BusType''.
+
| width="90%" | Baud Options
 
+
|-
Specifies the bus mode being used,
+
| colspan="2" | Baud rate option selector&nbsp;
 
+
|-
RS232 allows you to connect a single master node to a single slave node.
+
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
+
| width="90%" | Baud Rate
RS485 allows you to connect a single master node to multiple slave nodes.
+
|-
 
+
| colspan="2" | &nbsp;
<span style="font-weight: normal;"><u>Timeout</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''Timeout''.
+
| width="90%" | Bus
 
+
|-
Timeout in milliseconds used to dictate the maximum time to wait in milliseconds between bytes in a packet.
+
| colspan="2" | Specifies the bus mode being used, RS232 allows you to connect a single master node to a single slave node. RS485 allows you to connect a single master node to multiple slave nodes.&nbsp;
 
+
|-
Range: 1 - 255
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
+
| width="90%" | Timeout
<span style="font-weight: normal;"><u>Frame Type</u></span>
+
|-
 
+
| colspan="2" | Timeout in milliseconds used to dictate the maximum time to wait in milliseconds between bytes in a packet. Range: 1 - 255&nbsp;
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''FrameType''.
+
|-
 
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
Switches between RTU and ASCII forms of Modbus
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Modbus Properties
 
+
|-
<span style="font-weight: normal;"><u>Receive Buffer Size</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''ReceiveBufferSize''.
+
| width="90%" | Frame Type
 
+
|-
Maximum number of bytes the receive buffer can hold
+
| colspan="2" | Switches between RTU and ASCII forms of Modbus&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Slave ID Bytes</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
+
| width="90%" | Receive Buffer Size
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''AddressBytes''.
+
|-
 
+
| colspan="2" | Maximum number of bytes the receive buffer can hold&nbsp;
Number of bytes used when passing a slave ID, usually 1 but sometimes 2
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
<span style="font-weight: normal;"><u>Slave Address</u></span>
+
| width="90%" | Slave ID Bytes
 
+
|-
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''SlaveAddress''.
+
| colspan="2" | Number of bytes used when passing a slave ID, usually 1 but sometimes 2&nbsp;
 
+
|-
''<span style="color:red;">No additional information</span>''
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
+
| width="90%" | Slave Address
 
+
|-
 
+
| colspan="2" | &nbsp;
<span style="font-weight: normal;"><u>Label</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
This property is of type ''Line of text'' and can be referenced with the variable name ''label''.
+
| width="90%" | Reply Delay
 
+
|-
A text label to appear on the Modbus panel object.
+
| colspan="2" | Delay in micro seconds to wait before transmitting a reply&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Data Source</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
+
| width="90%" | Maintain Stats
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''DataSource''.
+
|-
 
+
| colspan="2" | Controls if the last command from the master is logged allowing for easier value updates. No - Do not log commands Yes - Commands are logged and available via the GetLastIncoming macro&nbsp;
Simulation data source used to allow the component to connect to COM port hardware or the the data injector components.
+
|-
 
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
<span style="font-weight: normal;"><u>COM Port</u></span>
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation Properties
 
+
|-
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''COM_port''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
COM port assigned to allow the simulation to communicate with actual Modbus hardware.
+
| width="90%" | Label
 
+
|-
<span style="font-weight: normal;"><u>Starting Address</u></span>
+
| colspan="2" | A text label to appear on the Modbus panel object.&nbsp;
 
+
|-
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''StartAdrCoil''.
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
+
| width="90%" | Scope Traces
''<span style="color:red;">No additional information</span>''
+
|-
 
+
| colspan="2" | Selects if the scope traces are automatically added to the data recorder window or not.    Simulation - draws an approximation of the UART data onto the scope trace.    ICT - sets up the scope trace for incoming data and adds UART packet decoding at the correct BAUD.&nbsp;
 
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
<span style="font-weight: normal;"><u>Number of Addresses</u></span>
+
| width="90%" | Console Data
 
+
|-
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''NumAdrCoil''.
+
| colspan="2" | Selects if the console data is automatically generated or not&nbsp;
 
+
|-
Specifies how many Coils are available on the slave. Max 80 coils.
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
+
| width="90%" | Console Columns
<span style="font-weight: normal;"><u>Starting Address</u></span>
+
|-
 
+
| colspan="2" | Number of characters that can be displayed on a single line of the console.&nbsp;
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''StartAdrDI''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
''<span style="color:red;">No additional information</span>''
+
| width="90%" | Data Source
 
+
|-
 
+
| colspan="2" | Simulation data source used to allow the component to connect to various remote devices    Nothing - Simulation data is ignored    COM port - Routes the communication data to and from a physical or virtual COM port      API - Routes the communication data via a data API component on the Panel.&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Number of Addresses</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | API
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''NumAdrDI''.
+
|-
 
+
| colspan="2" | Selects which API component to route the communication data via. Add API components to the panel before they will be available in this list. API components are available from the Comms component category.&nbsp;
Specifies how many Digital Inputs are available on the slave. Max 80.
+
|-
 
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
<span style="font-weight: normal;"><u>Starting Address</u></span>
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Modbus Coils - Single bit values
 
+
|-
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''StartAdrAI''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
''<span style="color:red;">No additional information</span>''
+
| width="90%" | Starting Address
 
+
|-
 
+
| colspan="2" | Start address of the Modbus coils. Referenced from 0. For example  Slave 1 might have 100 coils addressed 0-99 Start Address = 0 Slave 2 might have 100 coils addressed 100-199 Start Address = 100&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Number of Addresses</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
+
| width="90%" | Number of Addresses
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''NumAdrAI''.
+
|-
 
+
| colspan="2" | Specifies how many Coils are available on the slave. Each address consumes a single bit of RAM, 8 Addresses are packed together into a single RAM Byte.&nbsp;
Specifies how many 16-bit analogue inputs are available on the slave. Max 10.
+
|-
 
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
<span style="font-weight: normal;"><u>Starting Address</u></span>
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Digital Inputs - Single bit values
 
+
|-
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''StartAdrReg''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
''<span style="color:red;">No additional information</span>''
+
| width="90%" | Starting Address
 
+
|-
 
+
| colspan="2" | Start address of the Modbus digital inputs. Referenced from 0. For example  Slave 1 might have 100 inputs addressed 0-99 Start Address = 0 Slave 2 might have 100 inputs addressed 100-199 Start Address = 100&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Number of Addresses</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
+
| width="90%" | Number of Addresses
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''NumAdrReg''.
+
|-
 
+
| colspan="2" | Specifies how many Digital Inputs are available on the slave. Each address consumes a single bit of RAM, 8 Addresses are packed together into a single RAM Byte.&nbsp;
''<span style="color:red;">No additional information</span>''
+
|-
 +
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 +
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Analog Inputs - 16-bit values
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 +
| width="90%" | Starting Address
 +
|-
 +
| colspan="2" | Start address of the Modbus analogue inputs. Referenced from 0. For example  Slave 1 might have 100 inputs addressed 0-99 Start Address = 0 Slave 2 might have 100 inputs addressed 100-199 Start Address = 100&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 +
| width="90%" | Number of Addresses
 +
|-
 +
| colspan="2" | Specifies how many 16-bit analogue inputs are available on the slave. Each address consumes two RAM Bytes.&nbsp;
 +
|-
 +
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 +
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Holding Registers - 16-bit values
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 +
| width="90%" | Starting Address
 +
|-
 +
| colspan="2" | Start address of the Modbus registers. Referenced from 0. For example  Slave 1 might have 100 registers addressed 0-99 Start Address = 0 Slave 2 might have 100 registers addressed 100-199 Start Address = 100&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 +
| width="90%" | Number of Addresses
 +
|-
 +
| colspan="2" | Specifies how many 16-bit holding registers are available on the slave. Each address consumes two RAM Bytes.&nbsp;
 +
|}

Latest revision as of 13:12, 7 February 2023

Author Matrix Ltd.
Version 2.0
Category Comms: System


Modbus Slave component

Modbus component for creating Modbus compatible slave hardware via RS232 or RS485.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_ModbusSlave.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_ModbusSlave.fcfx

Detailed description

No detailed description exists yet for this component

Examples

Example master program to control the slave. The example reads the 8 switches connected to PortD. If the switch values change then the new value is send to the slave.

FC6 Icon.png Modbus Master Example


Example slave program to react to the signals from the master. The example listens for Modbus commands from the master and outputs the current coils 0-7 state to eight LEDs connected to PortD.

FC6 Icon.png Modbus Slave Example


Master and Slave example using vNet

Example of communicating using Modbus Master and Slave using two instances of Flowcode and the vNet injector component.

FC6 Icon.png ModbusMasterDemo

FC6 Icon.png ModBusSlaveDemo


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

Fc9-comp-macro.png ChangeBaud
Changes the UART Baud rate. 1 = 1200 / 2 = 2400 / 3 = 4800 / 4 = 9600 / 5 = 19200 / 6 = 31250 7 = 38400 / 8 = 57600 / 9 = 115200 
Fc9-u8-icon.png - BYTE Baud
The new baud rate (0=1200, 9=115200) 
Fc9-void-icon.png - VOID Return


ChangeFrameType

Fc9-comp-macro.png ChangeFrameType
Default frame type is the type set in the component properties. 
Fc9-u8-icon.png - BYTE Type
0 = Modbus RTU / 1 = Modbus ASCII 
Fc9-void-icon.png - VOID Return


CheckForIncoming

Fc9-comp-macro.png CheckForIncoming
Checks for an incoming message and if the data address is within range then also automatically replies with the correct reply. Returns 0 if no comms received, 1 for a succesful transaction, 255 for an error. 
Fc9-u8-icon.png - BYTE Return


GetLastIncoming

Fc9-comp-macro.png GetLastIncoming
Gets a value from the last incoming command. Index 0 = 0 Read / 1 Write Index 1 = 0 Coils / 1 DigInput / 2 AnInput / 3 Register Index 2 = Address Index 3 = Number 
Fc9-u8-icon.png - BYTE Index
Range: 0-3 
Fc9-u16-icon.png - UINT Return


Initialise

Fc9-comp-macro.png Initialise
Starts up the UART to allow communications and initialises the states of the various Modbus Coils, Inputs and Registers to 0. 
Fc9-void-icon.png - VOID Return


ReadAnalogInput

Fc9-comp-macro.png ReadAnalogInput
Reads the value of a single analogue input. 
Fc9-u16-icon.png - UINT Address
Coil Address 
Fc9-u16-icon.png - UINT Return


ReadCoils

Fc9-comp-macro.png ReadCoils
Reads the state of up to eight digital coils. Can pack a max of 8-bits together in a single operation 
Fc9-u16-icon.png - UINT StartAddress
Coil Address Range 0 to (NumCoils - 1) 
Fc9-u8-icon.png - BYTE AddressCount
Range 1-8 
Fc9-u8-icon.png - BYTE Return


ReadDigitalInputs

Fc9-comp-macro.png ReadDigitalInputs
Reads the state of up to eight digital inputs. Can pack a max of 8-bits together in a single operation 
Fc9-u16-icon.png - UINT StartAddress
Coil Address Range 0 to (NumCoils - 1) 
Fc9-u8-icon.png - BYTE AddressCount
Range 1-8 
Fc9-u8-icon.png - BYTE Return


ReadHoldingRegister

Fc9-comp-macro.png ReadHoldingRegister
Reads the value of a single holding register. 
Fc9-u16-icon.png - UINT Address
Coil Address 
Fc9-u16-icon.png - UINT Return


SetAnalogInput

Fc9-comp-macro.png SetAnalogInput
Sets the state of a single analogue input. 
Fc9-u16-icon.png - UINT Address
Coil Address 
Fc9-u16-icon.png - UINT Value
Analogue Value range 0 - 65535 
Fc9-void-icon.png - VOID Return


SetBaudRate

Fc9-comp-macro.png SetBaudRate
Allows the Baud Rate to be controlled dynamically overriding the default rate specified by the Baud component property. 
Fc9-u8-icon.png - BYTE Rate
0=1200, 1=2400, 2=4800, 3=9600, 4=19200, 5=38400, 6=57600, 7=115200 
Fc9-void-icon.png - VOID Return


SetCoil

Fc9-comp-macro.png SetCoil
Sets the state of a single digital coil. 
Fc9-u16-icon.png - UINT Address
Coil Address 
Fc9-u8-icon.png - BYTE State
0=off, 1=on 
Fc9-void-icon.png - VOID Return


SetDigitalInput

Fc9-comp-macro.png SetDigitalInput
Sets the state of a single digital input. 
Fc9-u16-icon.png - UINT Address
Coil Address 
Fc9-u8-icon.png - BYTE State
0=off, 1=on 
Fc9-void-icon.png - VOID Return


SetHoldingRegister

Fc9-comp-macro.png SetHoldingRegister
Sets the state of a single holding register. 
Fc9-u16-icon.png - UINT Address
Coil Address 
Fc9-u16-icon.png - UINT Value
Analogue Value range 0 - 65535 
Fc9-void-icon.png - VOID Return


SetSlaveAddress

Fc9-comp-macro.png SetSlaveAddress
Allows the slave address to be overridden from the default slave address specified in the component property. The number of bytes used for the address is fixed by the Slave ID Bytes property to save on RAM usage. 
Fc9-u16-icon.png - UINT SlaveAddress
 
Fc9-void-icon.png - VOID Return


Property reference

Fc9-prop-icon.png Properties
Fc9-conn-icon.png UART Properties
Fc9-type-16-icon.png Channel
UART Channel selector Software channels are bit banged using generic I/O pins but are not as reliable as hardware channels. Hardware channels use the selected peripheral on-board the target microcontroller. 
Fc9-type-5-icon.png TX
Pin to be used for Transmit data 
Fc9-type-5-icon.png RX
Pin to be used for Receive data 
Fc9-type-16-icon.png Baud Options
Baud rate option selector 
Fc9-type-14-icon.png Baud Rate
 
Fc9-type-16-icon.png Bus
Specifies the bus mode being used, RS232 allows you to connect a single master node to a single slave node. RS485 allows you to connect a single master node to multiple slave nodes. 
Fc9-type-21-icon.png Timeout
Timeout in milliseconds used to dictate the maximum time to wait in milliseconds between bytes in a packet. Range: 1 - 255 
Fc9-conn-icon.png Modbus Properties
Fc9-type-16-icon.png Frame Type
Switches between RTU and ASCII forms of Modbus 
Fc9-type-21-icon.png Receive Buffer Size
Maximum number of bytes the receive buffer can hold 
Fc9-type-21-icon.png Slave ID Bytes
Number of bytes used when passing a slave ID, usually 1 but sometimes 2 
Fc9-type-21-icon.png Slave Address
 
Fc9-type-21-icon.png Reply Delay
Delay in micro seconds to wait before transmitting a reply 
Fc9-type-7-icon.png Maintain Stats
Controls if the last command from the master is logged allowing for easier value updates. No - Do not log commands Yes - Commands are logged and available via the GetLastIncoming macro 
Fc9-conn-icon.png Simulation Properties
Fc9-type-10-icon.png Label
A text label to appear on the Modbus panel object. 
Fc9-type-7-icon.png Scope Traces
Selects if the scope traces are automatically added to the data recorder window or not. Simulation - draws an approximation of the UART data onto the scope trace. ICT - sets up the scope trace for incoming data and adds UART packet decoding at the correct BAUD. 
Fc9-type-7-icon.png Console Data
Selects if the console data is automatically generated or not 
Fc9-type-21-icon.png Console Columns
Number of characters that can be displayed on a single line of the console. 
Fc9-type-16-icon.png Data Source
Simulation data source used to allow the component to connect to various remote devices Nothing - Simulation data is ignored COM port - Routes the communication data to and from a physical or virtual COM port API - Routes the communication data via a data API component on the Panel. 
Fc9-type-16-icon.png API
Selects which API component to route the communication data via. Add API components to the panel before they will be available in this list. API components are available from the Comms component category. 
Fc9-conn-icon.png Modbus Coils - Single bit values
Fc9-type-21-icon.png Starting Address
Start address of the Modbus coils. Referenced from 0. For example Slave 1 might have 100 coils addressed 0-99 Start Address = 0 Slave 2 might have 100 coils addressed 100-199 Start Address = 100 
Fc9-type-21-icon.png Number of Addresses
Specifies how many Coils are available on the slave. Each address consumes a single bit of RAM, 8 Addresses are packed together into a single RAM Byte. 
Fc9-conn-icon.png Digital Inputs - Single bit values
Fc9-type-21-icon.png Starting Address
Start address of the Modbus digital inputs. Referenced from 0. For example Slave 1 might have 100 inputs addressed 0-99 Start Address = 0 Slave 2 might have 100 inputs addressed 100-199 Start Address = 100 
Fc9-type-21-icon.png Number of Addresses
Specifies how many Digital Inputs are available on the slave. Each address consumes a single bit of RAM, 8 Addresses are packed together into a single RAM Byte. 
Fc9-conn-icon.png Analog Inputs - 16-bit values
Fc9-type-21-icon.png Starting Address
Start address of the Modbus analogue inputs. Referenced from 0. For example Slave 1 might have 100 inputs addressed 0-99 Start Address = 0 Slave 2 might have 100 inputs addressed 100-199 Start Address = 100 
Fc9-type-21-icon.png Number of Addresses
Specifies how many 16-bit analogue inputs are available on the slave. Each address consumes two RAM Bytes. 
Fc9-conn-icon.png Holding Registers - 16-bit values
Fc9-type-21-icon.png Starting Address
Start address of the Modbus registers. Referenced from 0. For example Slave 1 might have 100 registers addressed 0-99 Start Address = 0 Slave 2 might have 100 registers addressed 100-199 Start Address = 100 
Fc9-type-21-icon.png Number of Addresses
Specifies how many 16-bit holding registers are available on the slave. Each address consumes two RAM Bytes.