Component: Data Injector Template (Comms Data Injectors)

From Flowcode Help
Revision as of 12:01, 3 February 2023 by Wiki bot (talk | contribs)
Jump to navigationJump to search
Author Matrix Ltd
Version 1.0
Category Comms Data Injectors


Data Injector Template component

A base data injector used as a placeholder in components which reference the data injector interface. Not recommended for use in projects.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_temp/InjectorBase.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_temp/InjectorBase.fcfx

Detailed description

No detailed description exists yet for this component

Examples

AT Example

GSM Example File FC6 Icon.png GSM Example Example should show the following on the display on the panel and on the hardware.

Error creating thumbnail: Unable to save thumbnail to destination


The AT injector component allows us to simulate the response of the GSM module.

Error creating thumbnail: Unable to save thumbnail to destination


CAN Example

The CAN component works together with the injector component to allow you to decode a CAN message ID into a meaningful command. FC6 Icon.png CAN_Example1 When a key on the keypad is pressed the CAN components transmits a CAN packet.

The CAN packet is decoded by the injector component to give us a meaningful log on the console window.


High Level CAN Data Console

Error creating thumbnail: Unable to save thumbnail to destination


Low Level CAN Data Console

Error creating thumbnail: Unable to save thumbnail to destination


Reference from CAN Injector to ID decode file, $(srcdir) refers to the current project directory.

Error creating thumbnail: Unable to save thumbnail to destination


Demo CAN ID file File:CANID.csv

Error creating thumbnail: Unable to save thumbnail to destination


DS1307 Example

This example uses the I2C master component combined with the DS1307 injector to simulate an I2C communications bus between the target Microcontroller and the virtual DS1307 device. FC6 Icon.png I2C DS1307 Example The panel displays the current time from the DS1307 RAM which is populated to match the system time.

Error creating thumbnail: Unable to save thumbnail to destination


The I2C console shows the communications between the target microcontroller and simulated I2C device.

Error creating thumbnail: Unable to save thumbnail to destination


The DS1307 console shows the contents of RAM memory on the simulated I2C device.

Error creating thumbnail: Unable to save thumbnail to destination


GPS Example

GPS Example File FC6 Icon.png GPS Example Example should show the Latitude generated by the GPS injector as well as the system time in simulation or UTC time on hardware.

Error creating thumbnail: Unable to save thumbnail to destination


Example data provided by the GPS NMEA injector component

Error creating thumbnail: Unable to save thumbnail to destination


Human Interface Example

This example receives a character via the RS232 component and outputs it to the LCD, an injector has been added to allow you to type data into the console. FC6 Icon.png Human Interface Injector Example The Console window has tabs for the human interface data injector allowing you to type in data that will be received by the component.

Error creating thumbnail: Unable to save thumbnail to destination


Again the RS232 console tabs reflect the data as it is sent and received.

Error creating thumbnail: Unable to save thumbnail to destination


LCD showing received data.

Error creating thumbnail: Unable to save thumbnail to destination


vNet Example

Here is an example of using the vNet injector to simulate a multi microcontroller system.

Microcontroller 1 is connected to a keypad and has a RS232 communications connection.

Microcontroller 2 is connected to a solenoid and has a RS232 communications connection.

Any key presses detected on microcontroller 1 will be sent via RS232 to microcontroller 2. If the correct byte sequence (1234) is received by microcontroller 2 then the solenoid is fired to unlock a door for 5 seconds. FC6 Icon.png vNet Example Node 1

FC6 Icon.png vNet Example Node 2 Communications over the vNet injector can be monitored using the console.

Error creating thumbnail: Unable to save thumbnail to destination


SCADA Slave Example

Using one of the SCADA Slave components together with one of the SCADA Slave injectors allows simulated comms data to be piped through to real world hardware. This allows for rapid prototyping and testing without the pains of repeated compilation and programming. This feature can be used with any component that contains SPI, I2C or UART based comms (depending on the hardware).

Here is an example using the Arduino Uno as the host board. The Arduino has been pre-programmed with the SCADA Slave firmware available from the Component: SCADA (Arduino Uno) (SCADA Slaves)


FC6 Icon.png Simple Arduino Uno Demo

Creating New Injector Components

Here are some example Injector component source files which go a good way towards demonstrating how to create your own injector component.

DS1307 I2C Device Example Injector Source

FC6 Icon.png InjectorDS1307

AT Device Example Injector Source

FC6 Icon.png InjectorAT

More information is available here: Matrix Flowcode Blog: Flowcode and Injector Components




Macro reference

ChangeState

Error creating thumbnail: Unable to save thumbnail to destination
ChangeState
Sets the state of the bus. SPI - Controls the chip select pin I2C - Controls the start/restart/stop status 
Error creating thumbnail: Unable to save thumbnail to destination
- BYTE
State
SPI: 0=CSLow, 1=CSHigh I2C: 0=Stop, 1=Start, 2=Restart 
Error creating thumbnail: Unable to save thumbnail to destination
- VOID
Return


GetRxConsoleHandle

Error creating thumbnail: Unable to save thumbnail to destination
GetRxConsoleHandle
Gets the handle to the console allowing data displaying on the panel etc. 
Error creating thumbnail: Unable to save thumbnail to destination
- HANDLE
Return


GetTxConsoleHandle

Error creating thumbnail: Unable to save thumbnail to destination
GetTxConsoleHandle
Gets the handle to the console allowing data displaying on the panel etc. 
Error creating thumbnail: Unable to save thumbnail to destination
- HANDLE
Return


InitialiseInjector

Error creating thumbnail: Unable to save thumbnail to destination
InitialiseInjector
 
Error creating thumbnail: Unable to save thumbnail to destination
- STRING
InjectorName
 
Error creating thumbnail: Unable to save thumbnail to destination
- BYTE
Return


RxByte

Error creating thumbnail: Unable to save thumbnail to destination
RxByte
Attempt to receive a byte back from the injector 0 - 255 = Valid data 256 = RX timeout no data available 
Error creating thumbnail: Unable to save thumbnail to destination
- UINT
Return


RxByteCount

Error creating thumbnail: Unable to save thumbnail to destination
RxByteCount
Returns the number of bytes currently sat in the receive buffer. 
Error creating thumbnail: Unable to save thumbnail to destination
- UINT
Return


TxByte

Error creating thumbnail: Unable to save thumbnail to destination
TxByte
Transmit a byte out to the Injector 
Error creating thumbnail: Unable to save thumbnail to destination
- BYTE
Data
 
Error creating thumbnail: Unable to save thumbnail to destination
- VOID
Return



Property reference

Error creating thumbnail: Unable to save thumbnail to destination
Properties
Error creating thumbnail: Unable to save thumbnail to destination
Circular Buffer Size