Component: Modbus Slave (SCADA) (Comms: System)

From Flowcode Help
Jump to navigationJump to search
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.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_Modbus_Slave_SCADA.fcsx

Please click here to view the component source code (Beta): FC_Comp_Source_Modbus_Slave_SCADA.fcsx

Detailed description

No detailed description exists yet for this component

Examples

No additional examples








Macro reference

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


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 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 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-conn-icon.png Runtime Properties
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-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.