Component: Injector (SCADA Slave SPI) (Comms)

From Flowcode Help
Jump to navigationJump to search


Author Matrix Ltd
Version 1.2 (Release)
Category Comms
This inherits from Data Injector Template


Image Injector (SCADA Slave SPI) component

Comms data injector to allow a SPI bus peripheral to be attached to a comms component. The component will forward any byte transactions through to a SCADA Slave enabled hardware. Enabling the Flowcode simulation runtime to directly drive a physical SPI bus.

Examples

No additional examples


Downloadable macro reference

This component does not contain any downloadable macros

Simulation macro reference

This component inherits simulation macros from Data Injector Template

InitialiseInjector

Sets up the injector ready to receive commands or send data

Parameters

<- STRING InjectorName
Name of the console that will be created
This parameter may be returned back to the caller


Return value

BYTE


RxByteCount

Returns the number of bytes currently sat in the receive buffer.

This call is provided by Data Injector Template

Parameters

This macro has no parameters


Return value

UINT


TxByte

Puts a byte onto the comms channel.

Parameters

BYTE DataByte


Return value

This call does not return a value


RxByte

Attempt to receive a byte back from the injector

0 - 255 = Valid data

256 = RX timeout no data available

Parameters

This macro has no parameters


Return value

UINT


GetTxConsoleHandle

Gets the handle to the console allowing data displaying on the panel etc.

This call is provided by Data Injector Template

Parameters

This macro has no parameters


Return value

HANDLE


ChangeState

Sets the state of the bus.

SPI - Controls the chip select pin

I2C - Controls the start/restart/stop status

Parameters

BYTE State
SPI: 0=CSLow, 1=CSHigh I2C: 0=Stop, 1=Start, 2=Restart


Return value

This call does not return a value


GetRxConsoleHandle

Gets the handle to the console allowing data displaying on the panel etc.

This call is provided by Data Injector Template

Parameters

This macro has no parameters


Return value

HANDLE


GetConsoleHandle

Gets the handle to the console allowing data displaying on the panel etc.

Parameters

This macro has no parameters


Return value

HANDLE



Property reference

SCADA Slave

This property is of type Panel object and can be referenced with the variable name SCADASlave.

SCADA Slave component to use to pipe data to a physical SPI bus

CS Pin Number

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

Digital I/O pin number to use for the CS pin

SPI Prescaler

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

Sets the prescaler rate of the SPI bus.

See the SCADA Slave SPIPrescaler macro for valid values,