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

From Flowcode Help
Jump to navigationJump to search
(XML import)
 
Line 1: Line 1:
 
+
{| style="width:50%"
 
 
{| width="50%"
 
 
|-
 
|-
| width="20%" style="color: gray;" | Author
+
| width="20%" style="color:gray;" | Author
 
| Matrix TSL
 
| Matrix TSL
 
|-
 
|-
| width="20%" style="color: gray;" | Version
+
| width="20%" style="color:gray;" | Version
| 1.0 (Release)
+
| 1.0
 
|-
 
|-
| width="20%" style="color: gray;" | Category
+
| width="20%" style="color:gray;" | Category
 
| Comms: System
 
| Comms: System
 
|}
 
|}
  
  
 
+
==Modbus Slave (SCADA) component==
==[[File:Component Icon a93b1f52_b96d_4a14_806e_63f73d2654b2.png|Image]] Modbus Slave (SCADA) 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==
+
==Detailed description==
''<span style="color:red;">No additional examples</span>''
 
  
 +
''No detailed description exists yet for this component''
  
==Downloadable macro reference==
+
==Examples==
  
===<span style="font-weight: normal;"><u><tt>ReadHoldingRegister</tt></u></span>===
 
Reads the value of a single holding register.
 
  
'''Parameters'''
+
''<span style="color:red;">No additional examples</span>''
  
:[[Variable Types|UINT]] ''Address''
 
::Coil Address
 
  
 +
==Downloadable macro reference==
  
'''Return value'''
+
{| 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''
 +
|}
  
:[[Variable Types|UINT]]
 
  
 +
{| 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''
 +
|}
  
===<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
+
{| 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''
 +
|}
  
'''Parameters'''
 
  
:[[Variable Types|UINT]] ''StartAddress''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::Coil Address Range 0 to (NumCoils - 1)
+
|-
 +
| 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''
 +
|}
  
:[[Variable Types|BYTE]] ''AddressCount''
 
::Range 1-8
 
  
 +
{| 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''
 +
|}
  
'''Return value'''
 
  
:[[Variable Types|BYTE]]
+
{| 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''
 +
|}
  
  
===<span style="font-weight: normal;"><u><tt>ReadAnalogueInput</tt></u></span>===
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
Reads the value of a single analogue input.
+
|-
 +
| 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''
 +
|}
  
'''Parameters'''
 
  
:[[Variable Types|UINT]] ''Address''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::Coil Address
+
|-
 +
| 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''
 +
|}
  
  
'''Return value'''
+
{| 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''
 +
|}
  
:[[Variable Types|UINT]]
 
  
 +
{| 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''
 +
|}
  
===<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
+
{| 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" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Parameters'''
 
  
:[[Variable Types|UINT]] ''StartAddress''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::Coil Address Range 0 to (NumCoils - 1)
+
|-
 +
| 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''
 +
|}
  
:[[Variable Types|BYTE]] ''AddressCount''
 
::Range 1-8
 
  
 +
{| 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]]
+
{| 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;" | '''AppendStringToFile'''
 +
|-
 +
| colspan="2" | Adds the contents of the data string parameter to the end of the currently open file. Returns 0 for success.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 +
| width="90%" | Data_String
 +
|-
 +
| colspan="2" | Data to append to the end of the file&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''
 +
|}
  
  
===<span style="font-weight: normal;"><u><tt>SetSlaveAddress</tt></u></span>===
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
Allows the slave address to be overridden from the default slave address specified
+
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadFileSize'''
 +
|-
 +
| colspan="2" | Reads the entire size of the current file in bytes.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u32-icon.png]] - ULONG
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
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.
+
{| 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;" | '''SetTimeAndDate'''
 +
|-
 +
| colspan="2" | Sets the current time and date.  Time = (Hour << 11) + (Min << 5) + (Sec >> 1) Date = (YearFrom1980 << 9) + (Month << 5) + (Day) Additional details can be found here: http://www.maverick-os.dk/FileSystemFormats/FAT16_FileSystem.html#TimeFormat&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | Time
 +
|-
 +
| colspan="2" | Sets the current Time in FAT Time format hhhhhmmmmmmsssss - S=Secs/2&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | Date
 +
|-
 +
| colspan="2" | Sets the current Date in FAT Date format yyyyyyymmmmddddd - Y=Years since 1980&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''
 +
|}
  
'''Parameters'''
 
  
:[[Variable Types|UINT]] ''SlaveAddress''
+
{| 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" | Attempts to communicate with the SD card and if successful sets up the file system. Returns 0 for success. &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''
 +
|}
  
  
'''Return value'''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
+
|-
:''This call does not return a value''
+
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
+
|-
===<span style="font-weight: normal;"><u><tt>SetCoilState</tt></u></span>===
+
| colspan="2" | Initialise the comms to the Arduino board ready for commands to be sent.&nbsp;
Sets the state of a single digital coil.
+
|-
 
+
|-
'''Parameters'''
+
| 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''
:[[Variable Types|UINT]] ''Address''
+
|}
::Coil Address
 
 
 
:[[Variable Types|BYTE]] ''State''
 
::0=off, 1=on
 
 
 
 
 
'''Return value'''
 
 
 
:''This call does not return a value''
 
 
 
 
 
===<span style="font-weight: normal;"><u><tt>ChangeFrameType</tt></u></span>===
 
Default frame type is the type set in the component properties.
 
 
 
'''Parameters'''
 
 
 
:[[Variable Types|BYTE]] ''Type''
 
::0 = Modbus RTU / 1 = Modbus ASCII
 
 
 
 
 
'''Return value'''
 
 
 
:''This call does not return a value''
 
 
 
  
===<span style="font-weight: normal;"><u><tt>SetInputState</tt></u></span>===
 
Sets the state of a single digital input.
 
  
'''Parameters'''
 
 
:[[Variable Types|UINT]] ''Address''
 
::Coil Address
 
 
:[[Variable Types|BYTE]] ''State''
 
::0=off, 1=on
 
 
 
'''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''
 
::Analogue Value range 0 - 65535
 
 
 
'''Return value'''
 
 
:''This call does not return a value''
 
 
 
===<span style="font-weight: normal;"><u><tt>CheckForIncoming</tt></u></span>===
 
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.
 
 
'''Parameters'''
 
 
:''This macro has no parameters''
 
 
 
'''Return value'''
 
 
:[[Variable Types|BYTE]]
 
 
 
===<span style="font-weight: normal;"><u><tt>GetLastIncoming</tt></u></span>===
 
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
 
 
'''Parameters'''
 
 
:''This macro has no parameters''
 
 
 
'''Return value'''
 
 
:[[Variable Types|UINT]]
 
 
 
===<span style="font-weight: normal;"><u><tt>SetAnalogueInput</tt></u></span>===
 
Sets the state of a single analogue input.
 
 
'''Parameters'''
 
 
:[[Variable Types|UINT]] ''Address''
 
::Coil Address
 
 
:[[Variable Types|UINT]] ''Value''
 
::Analogue Value range 0 - 65535
 
 
 
'''Return value'''
 
 
:''This call does not return a value''
 
 
 
===<span style="font-weight: normal;"><u><tt>Initialise</tt></u></span>===
 
Starts up the UART to allow communications and initialises the states of the various
 
 
Modbus Coils, Inputs and Registers to 0.
 
 
'''Parameters'''
 
 
:''This macro has no parameters''
 
 
 
'''Return value'''
 
 
:''This call does not return a value''
 
 
 
 
==Simulation macro reference==
 
 
''This component does not contain any simulation macros''
 
  
  
 
==Property reference==
 
==Property reference==
<span style="font-weight: normal;"><u>Frame Type</u></span>
 
  
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''FrameType''.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
+
|-
Switches between RTU and ASCII forms of Modbus
+
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
<span style="font-weight: normal;"><u>Receive Buffer Size</u></span>
+
|-
 
+
|-
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''ReceiveBufferSize''.
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| 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>Receive Timeout</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''Timeout''.
+
| width="90%" | Receive Buffer Size
 
+
|-
Length in milliseconds to wait for additional bytes to be received when checking for incoming messages.
+
| colspan="2" | Maximum number of bytes the receive buffer can hold&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 Timeout
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''AddressBytes''.
+
|-
 
+
| colspan="2" | Length in milliseconds to wait for additional bytes to be received when checking for incoming messages.&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>Reply Delay</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''ReplyDelay''.
+
| width="90%" | Reply Delay
 
+
|-
Delay in micro seconds to wait before transmitting a reply
+
| colspan="2" | Delay in micro seconds to wait before transmitting a reply&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Maintain Stats</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
+
| width="90%" | Maintain Stats
This property is of type ''True or false'' and can be referenced with the variable name ''Stats''.
+
|-
 
+
| 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;
Controls if the last command from the master is logged allowing for easier value updates.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
No - Do not log commands
+
| width="90%" | Label
 
+
|-
Yes - Commands are logged and available via the GetLastIncoming macro
+
| colspan="2" | A text label to appear on the Modbus panel object.&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Label</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
+
| width="90%" | Console Data
This property is of type ''Line of text'' and can be referenced with the variable name ''label''.
+
|-
 
+
| colspan="2" | Selects if the console data is automatically generated or not&nbsp;
A text label to appear on the Modbus panel object.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
<span style="font-weight: normal;"><u>Console Data</u></span>
+
| width="90%" | Console Columns
 
+
|-
This property is of type ''True or false'' and can be referenced with the variable name ''scada_uart1::ConsoleData''.
+
| colspan="2" | Number of characters that can be displayed on a single line of the console.&nbsp;
 
+
|-
Selects if the console data is automatically generated or not
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | Data Source
<span style="font-weight: normal;"><u>Console Columns</u></span>
+
|-
 
+
| 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     Injector - Routes the communication data via a data injector component on the Panel.&nbsp;
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''scada_uart1::ConsoleColumns''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
Number of characters that can be displayed on a single line of the console.
+
| width="90%" | COM Port
 
+
|-
<span style="font-weight: normal;"><u>Data Source</u></span>
+
| colspan="2" | Lists all the current available COM port hardware on your PC.&nbsp;
 
+
|-
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''scada_uart1::DataSource''.
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
+
| width="90%" | Refresh Ports
Simulation data source used to allow the component to connect to various remote devices
+
|-
 
+
| colspan="2" | &nbsp;
     Nothing - Simulation data is ignored
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
     COM port - Routes the communication data to and from a physical or virtual COM port  
+
| width="90%" | Baud Rate
 
+
|-
    Injector - Routes the communication data via a data injector component on the Panel.
+
| colspan="2" | COM port data rate in bits per second&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>COM Port</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
+
| width="90%" | Starting Address
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''scada_uart1::com_port''.
+
|-
 
+
| 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;
Lists all the current available COM port hardware on your PC.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
<span style="font-weight: normal;"><u>Baud Rate</u></span>
+
| width="90%" | Number of Addresses
 
+
|-
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''scada_uart1::baud''.
+
| 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;
 
+
|-
COM port data rate in bits per second
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
+
| width="90%" | Starting Address
<span style="font-weight: normal;"><u>Starting Address</u></span>
+
|-
 
+
| 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;
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''StartAdrCoil''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
Start address of the Modbus coils. Referenced from 0.
+
| width="90%" | Number of Addresses
 
+
|-
For example  
+
| 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;
 
+
|-
Slave 1 might have 100 coils addressed 0-99 Start Address = 0
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
+
| width="90%" | Starting Address
Slave 2 might have 100 coils addressed 100-199 Start Address = 100
+
|-
 
+
| 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;
<span style="font-weight: normal;"><u>Number of Addresses</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''NumAdrCoil''.
+
| width="90%" | Number of Addresses
 
+
|-
Specifies how many Coils are available on the slave.
+
| colspan="2" | Specifies how many 16-bit analogue inputs are available on the slave. Each address consumes two RAM Bytes.&nbsp;
 
+
|-
Each address consumes a single bit of RAM, 8 Addresses are packed together into a single RAM Byte.
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
+
| width="90%" | Starting Address
<span style="font-weight: normal;"><u>Starting Address</u></span>
+
|-
 
+
| 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;
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''StartAdrDI''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
Start address of the Modbus digital inputs. Referenced from 0.
+
| width="90%" | Number of Addresses
 
+
|-
For example  
+
| colspan="2" | Specifies how many 16-bit holding registers are available on the slave. Each address consumes two RAM Bytes.&nbsp;
 
+
|-
Slave 1 might have 100 inputs addressed 0-99 Start Address = 0
+
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Connections'''
Slave 2 might have 100 inputs addressed 100-199 Start Address = 100
+
|-
 
+
|-
<span style="font-weight: normal;"><u>Number of Addresses</u></span>
+
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Simulations'''
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''NumAdrDI''.
+
|-
 
+
|}
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.
 
 
 
<span style="font-weight: normal;"><u>Starting Address</u></span>
 
 
 
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''StartAdrAI''.
 
 
 
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
 
 
 
<span style="font-weight: normal;"><u>Number of Addresses</u></span>
 
 
 
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''NumAdrAI''.
 
 
 
Specifies how many 16-bit analogue inputs are available on the slave.
 
 
 
Each address consumes two RAM Bytes.
 
 
 
<span style="font-weight: normal;"><u>Starting Address</u></span>
 
 
 
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''StartAdrReg''.
 
 
 
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
 
 
 
<span style="font-weight: normal;"><u>Number of Addresses</u></span>
 
 
 
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''NumAdrReg''.
 
 
 
Specifies how many 16-bit holding registers are available on the slave.
 
 
 
Each address consumes two RAM Bytes.
 

Revision as of 20:43, 16 November 2021

Author Matrix TSL
Version 1.0
Category Comms: System


Modbus Slave (SCADA) component

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

Detailed description

No detailed description exists yet for this component

Examples

No additional examples


Downloadable macro reference

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


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


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


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


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


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


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


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


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


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


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-u16-icon.png - UINT Return


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


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


Fc9-comp-macro.png AppendStringToFile
Adds the contents of the data string parameter to the end of the currently open file. Returns 0 for success. 
Fc9-string-icon.png - STRING Data_String
Data to append to the end of the file 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png ReadFileSize
Reads the entire size of the current file in bytes. 
Fc9-u32-icon.png - ULONG Return


Fc9-comp-macro.png SetTimeAndDate
Sets the current time and date. Time = (Hour << 11) + (Min << 5) + (Sec >> 1) Date = (YearFrom1980 << 9) + (Month << 5) + (Day) Additional details can be found here: http://www.maverick-os.dk/FileSystemFormats/FAT16_FileSystem.html#TimeFormat 
Fc9-u16-icon.png - UINT Time
Sets the current Time in FAT Time format hhhhhmmmmmmsssss - S=Secs/2 
Fc9-u16-icon.png - UINT Date
Sets the current Date in FAT Date format yyyyyyymmmmddddd - Y=Years since 1980 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png Initialise
Attempts to communicate with the SD card and if successful sets up the file system. Returns 0 for success.  
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png Initialise
Initialise the comms to the Arduino board ready for commands to be sent. 
Fc9-void-icon.png - VOID Return



Property reference

Fc9-prop-icon.png 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 Receive Timeout
Length in milliseconds to wait for additional bytes to be received when checking for incoming messages. 
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-type-10-icon.png Label
A text label to appear on the Modbus panel object. 
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 Injector - Routes the communication data via a data injector component on the Panel. 
Fc9-type-16-icon.png COM Port
Lists all the current available COM port hardware on your PC. 
Fc9-type-7-icon.png Refresh Ports
 
Fc9-type-21-icon.png Baud Rate
COM port data rate in bits per second 
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-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-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-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. 
Fc9-conn-icon.png Connections
Fc9-conn-icon.png Simulations