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

From Flowcode Help
Jump to navigationJump to search
(XML import)
 
(XML import)
Line 88: Line 88:
  
 
:[[Variable Types|BYTE]]
 
:[[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''
  
  
Line 117: Line 134:
 
:[[Variable Types|BYTE]] ''State''
 
:[[Variable Types|BYTE]] ''State''
 
::0=off, 1=on
 
::0=off, 1=on
 +
 +
 +
'''Return value'''
 +
 +
:''This call does not return a value''
 +
 +
 +
===<span style="font-weight: normal;"><u><tt>SetBaudRate</tt></u></span>===
 +
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
  
  

Revision as of 15:40, 27 July 2016


Author Matrix Ltd.
Version 1.2 (Release)
Category Comms: System


Image Modbus Slave component

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

Examples

No additional examples


Downloadable macro reference

ReadHoldingRegister

Reads the value of a single holding register.

Parameters

UINT Address
Coil Address


Return value

UINT


ReadCoilStates

Reads the state of a single digital coil.

Can pack a max of 8-bits together in a single operation

Parameters

UINT StartAddress
Coil Address Range 0 to (NumCoils - 1)
BYTE AddressCount
Range 1-8


Return value

BYTE


ReadAnalogueInput

Reads the value of a single analogue input.

Parameters

UINT Address
Coil Address


Return value

UINT


ReadInputStates

Reads the state of a single digital input.

Can pack a max of 8-bits together in a single operation

Parameters

UINT StartAddress
Coil Address Range 0 to (NumCoils - 1)
BYTE AddressCount
Range 1-8


Return value

BYTE


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.

Parameters

UINT SlaveAddress


Return value

This call does not return a value


SetCoilState

Sets the state of a single digital coil.

Parameters

UINT Address
Coil Address
BYTE State
0=off, 1=on


Return value

This call does not return a value


SetInputState

Sets the state of a single digital input.

Parameters

UINT Address
Coil Address
BYTE State
0=off, 1=on


Return value

This call does not return a value


SetBaudRate

Allows the Baud Rate to be controlled dynamically overriding the default

rate specified by the Baud component property.

Parameters

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


SetHoldingRegister

Sets the state of a single holding register.

Parameters

UINT Address
Coil Address
UINT Value
Analogue Value range 0 - 65535


Return value

This call does not return a value


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.

Parameters

This macro has no parameters


Return value

BYTE


SetAnalogueInput

Sets the state of a single analogue input.

Parameters

UINT Address
Coil Address
UINT Value
Analogue Value range 0 - 65535


Return value

This call does not return a value


Initialise

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

Channel

This property is of type Fixed list of ints and can be referenced with the variable name CHANNEL.

UART channel to specify an onboard hardware channel.

Software channels are not availlable as we rely on hardware UART RX interrupts to pull in the data

TX

This property is of type Single digital pin and can be referenced with the variable name TX.

UART transmit pin

RX

This property is of type Single digital pin and can be referenced with the variable name RX.

UART receive pin

Baud Rate

This property is of type Fixed list of ints and can be referenced with the variable name BAUD_LIST.

Data rate in bits per second

Bus

This property is of type Fixed list of ints and can be referenced with the variable name BusType.

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.

Timeout

This property is of type Unsigned integer and can be referenced with the variable name Timeout.

Timeout in milliseconds used to dictate the maximum time to wait in milliseconds between bytes in a packet.

Range: 1 - 255

Frame Type

This property is of type Fixed list of ints and can be referenced with the variable name FrameType.

Switches between RTU and ASCII forms of Modbus

Receive Buffer Size

This property is of type Unsigned integer and can be referenced with the variable name ReceiveBufferSize.

Maximum number of bytes the receive buffer can hold

Slave ID Bytes

This property is of type Unsigned integer and can be referenced with the variable name AddressBytes.

Number of bytes used when passing a slave ID, usually 1 but sometimes 2

Slave Address

This property is of type Unsigned integer and can be referenced with the variable name SlaveAddress.

No additional information


Label

This property is of type Line of text and can be referenced with the variable name label.

A text label to appear on the Modbus panel object.

Data Source

This property is of type Fixed list of ints and can be referenced with the variable name DataSource.

Simulation data source used to allow the component to connect to COM port hardware or the the data injector components.

COM Port

This property is of type Fixed list of ints and can be referenced with the variable name COM_port.

COM port assigned to allow the simulation to communicate with actual Modbus hardware.

Starting Address

This property is of type Unsigned integer and can be referenced with the variable name StartAdrCoil.

No additional information


Number of Addresses

This property is of type Unsigned integer and can be referenced with the variable name NumAdrCoil.

Specifies how many Coils are available on the slave. Max 80 coils.

Starting Address

This property is of type Unsigned integer and can be referenced with the variable name StartAdrDI.

No additional information


Number of Addresses

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. Max 80.

Starting Address

This property is of type Unsigned integer and can be referenced with the variable name StartAdrAI.

No additional information


Number of Addresses

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. Max 10.

Starting Address

This property is of type Unsigned integer and can be referenced with the variable name StartAdrReg.

No additional information


Number of Addresses

This property is of type Unsigned integer and can be referenced with the variable name NumAdrReg.

No additional information