Difference between revisions of "Component: Injector (CAN) (Comms)"

From Flowcode Help
Jump to navigationJump to search
(XML import)
 
(XML import BR)
 
(One intermediate revision by the same user not shown)
Line 22: Line 22:
  
 
==Examples==
 
==Examples==
''<span style="color:red;">No additional examples</span>''
+
The CAN component works together with the injector component to allow you to decode a CAN message ID into a meaningful command.
  
 +
Example File
 +
{{Fcfile|CAN_Demo.fcfx|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
 +
 +
[[File:CAN_High.jpg]]
 +
 +
 +
Low Level CAN Data Console
 +
 +
[[File:CAN_Low.jpg]]
 +
 +
 +
Reference from CAN Injector to ID decode file, $(srcdir) refers to the current project directory.
 +
 +
[[File:CAN_File.jpg]]
 +
 +
 +
Demo CAN ID file [[File:CANID.csv]]
 +
 +
[[File:CAN_DataFile.jpg]]
  
 
==Downloadable macro reference==
 
==Downloadable macro reference==

Latest revision as of 15:46, 16 February 2017


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


Image Injector (CAN) component

Comms data injector to allow CAN message identifiers to be decoded to specific message strings. Uses an external CSV file to specify the IDs and descriptive strings.

Examples

The CAN component works together with the injector component to allow you to decode a CAN message ID into a meaningful command.

Example File 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

CAN High.jpg


Low Level CAN Data Console

CAN Low.jpg


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

CAN File.jpg


Demo CAN ID file File:CANID.csv

CAN DataFile.jpg

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.

CAN packet is inserted into injector like this:

ID3, ID2, ID1, ID0, D7, D6, D5, D4, D3, D2, D1, D0, \n

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

This call is provided by Data Injector Template

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

Changes the state for I2C or SPI type comms where the data bytes along are not enough to go on.

This call is provided by Data Injector Template

Parameters

BYTE NewState
Assigns new state, 0=default


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

BYTE HandleIndex
Selects which console handle to obtain - 0=ID/Data 1=ID Meanings


Return value

HANDLE



Property reference

Circular Buffer Size

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

Number of bytes that can be held in the injector's circular buffer

Termination Character

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

Used to signify the end of a message, in the case of CAN it will end a specific identifier message

CSV ID File

This property is of type Filename and can be referenced with the variable name CSVFile.

Location of comma seperated ID description file.

e.g.

ID,Description

1,Door Open

2,Door Closed

3,Window Open

4,Window Closed

1023,System Disable

1024,System Enable