Jump to content

Component: CAN Bus BL0140 (E-blocks 2): Difference between revisions

From Flowcode Help
No edit summary
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder""
 
(15 intermediate revisions by 2 users not shown)
Line 15: Line 15:




==Component Source Code==
==Detailed description==
 
 
 
 


Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_EBlocks2_CAN_Bus_BL0140_2d.fcfx FC_Comp_Source_EBlocks2_CAN_Bus_BL0140_2d.fcfx]


==Detailed description==




Line 30: Line 32:


==Examples==
==Examples==




Line 38: Line 46:


''<span style="color:red;">No additional examples</span>''
''<span style="color:red;">No additional examples</span>''


==Macro reference==
==Macro reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===ChangeRate===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''ChangeRate'''
|-
| colspan="2" | Simple attempt to alter the bus rate of the CAN. External CAN channels only,&nbsp;
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadSwitches'''
|-
|-
| colspan="2" | Returns switch input states from the external MCP2515 device. 0 = No Switch Pressed, 1 = Switch 1 Pressed, 2 = Switch 2 Pressed, 3 = Both Pressed (External CAN only) &nbsp;
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Rate
|-
|-
| colspan="2" | Rate: 0-3 where 0=125, 1=250, 2=500, 3=1000&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===CheckRx===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetTxData'''
| width="90%" class="mtx-class-macrohead" | '''CheckRx'''
|-
|-
| colspan="2" | Assigns one of the outgoing transmit buffers with data ready to be sent.&nbsp;
| colspan="2" | Checks to see if any messages are available for 'Buffer' specified &nbsp;
|-
|-
|-
|-
Line 65: Line 94:
| width="90%" | Buffer
| width="90%" | Buffer
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | Send buffer: 0  to 1&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Count
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | d0
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | d1
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | d2
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | d3
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | d4
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | d5
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | d6
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | d7
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===GetRxData===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetRxMask'''
| width="90%" class="mtx-class-macrohead" | '''GetRxData'''
|-
|-
| colspan="2" | Allows the receive ID mask to be configured on the fly allowing different ID ranges to be received.&nbsp;
| colspan="2" | Returns last received message data byte at position Index. Buffer parameter is currently ignored&nbsp;
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Mask
| width="90%" | Buffer
|-
|-
| colspan="2" | Specifies which receive mask to modify. Range: 0-1&nbsp;
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | ID
| width="90%" | Index
|-
|-
| colspan="2" | The ID mask value you wish to use&nbsp;
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===GetRxDataCount===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetRxData'''
| width="90%" class="mtx-class-macrohead" | '''GetRxDataCount'''
|-
|-
| colspan="2" | Returns last received message data byte at position Index. Buffer parameter is currently ignored&nbsp;
| colspan="2" | Returns last received message data length. Buffer parameter is currently ignored&nbsp;
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Buffer
| width="90%" | Buffer
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Index
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | &nbsp;
Line 163: Line 144:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===GetRxIDHi===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetRxIDHi'''
| width="90%" class="mtx-class-macrohead" | '''GetRxIDHi'''
|-
|-
| colspan="2" | Gets the Hi byte Rx ID in register format. Standard ID only 0-2047. Compatible with v5 component and previous, &nbsp;
| colspan="2" | Gets the Hi byte Rx ID in register format. Standard ID only 0-2047. Compatible with v5 component and previous, &nbsp;
Line 181: Line 163:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===GetRxIDLo===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetTxIDSimple'''
| width="90%" class="mtx-class-macrohead" | '''GetRxIDLo'''
|-
|-
| colspan="2" | Set the Tx CAN ID as a generic number. Standard IDs only 0-2047. &nbsp;
| colspan="2" | Gets the Lo byte Rx ID in register format. Standard ID only 0-2047. Compatible with v5 component and previous, &nbsp;
|-
|-
|-
|-
Line 192: Line 175:
| width="90%" | Buffer
| width="90%" | Buffer
|-
|-
| colspan="2" | Transmit buffer to load. Range: 0-2&nbsp;
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | ID
|-
| colspan="2" | The ID value you wish to use. Range: 0-2047&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===GetRxIDSimple===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendBuffer'''
| width="90%" class="mtx-class-macrohead" | '''GetRxIDSimple'''
|-
|-
| colspan="2" | Transmits one of the transmit buffers which should have already been populated with an ID and data.&nbsp;
| colspan="2" | Gets the Rx ID as a Integer Standard ID only 0-2047.&nbsp;
|-
|-
|-
|-
Line 215: Line 194:
| width="90%" | Buffer
| width="90%" | Buffer
|-
|-
| colspan="2" | Specifies which transmit buffer to send&nbsp;
| colspan="2" | Receive Buffer. Range 0-1&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===GetRxIdent===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetRxDataCount'''
| width="90%" class="mtx-class-macrohead" | '''GetRxIdent'''
|-
|-
| colspan="2" | Returns last received message data length. Buffer parameter is currently ignored&nbsp;
| colspan="2" | Gets the Rx ID as a Integer Standard and Extended IDs.&nbsp;
|-
|-
|-
|-
Line 235: Line 215:
| colspan="2" | &nbsp;
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u32-icon.png]] - ULONG
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===Initialise===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetRxFilterID'''
| width="90%" class="mtx-class-macrohead" | '''Initialise'''
|-
|-
| colspan="2" | sets the Filter Standard mode only  (for V5 compatibility only)&nbsp;
| colspan="2" | Must be called before any other CAN component macros to enable and initialise the CAN peripheral. &nbsp;
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" | Filter
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
===ReadSwitches===
{| class="mtx-class-macrotable wikitable"
|-
|-
| colspan="2" | Specifies which filter to modify. Range: 0-5&nbsp;
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''ReadSwitches'''
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| colspan="2" | Returns switch input states from the external MCP2515 device. 0 = No Switch Pressed, 1 = Switch 1 Pressed, 2 = Switch 2 Pressed, 3 = Both Pressed (External CAN only) &nbsp;
| width="90%" | Hi
|-
|-
| colspan="2" | ID bits 3-10&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Lo
|-
| colspan="2" | ID bits 0-2 stored in the upper 3 bits of the byte&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===SendBuffer===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetRxIDLo'''
| width="90%" class="mtx-class-macrohead" | '''SendBuffer'''
|-
|-
| colspan="2" | Gets the Lo byte Rx ID in register format. Standard ID only 0-2047. Compatible with v5 component and previous, &nbsp;
| colspan="2" | Transmits one of the transmit buffers which should have already been populated with an ID and data.&nbsp;
|-
|-
|-
|-
Line 279: Line 260:
| width="90%" | Buffer
| width="90%" | Buffer
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | Specifies which transmit buffer to send&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===SetRxFilter===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetRxFilter'''
| width="90%" class="mtx-class-macrohead" | '''SetRxFilter'''
|-
|-
| colspan="2" | Allows the receive ID filter to be configured on the fly allowing different ID ranges to be received.&nbsp;
| colspan="2" | Allows the receive ID filter to be configured on the fly allowing different ID ranges to be received.&nbsp;
Line 309: Line 291:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===SetRxFilterID===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetRxMaskID'''
| width="90%" class="mtx-class-macrohead" | '''SetRxFilterID'''
|-
|-
| colspan="2" | set the Mask Standard ID mode only (for V5 compatibility) &nbsp;
| colspan="2" | sets the Filter Standard mode only (for V5 compatibility only)&nbsp;
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Mask
| width="90%" | Filter
|-
|-
| colspan="2" | Specifies which receive mask to modify. Range: 0-1&nbsp;
| colspan="2" | Specifies which filter to modify. Range: 0-5&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
Line 337: Line 320:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===SetRxMask===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetTxIdent'''
| width="90%" class="mtx-class-macrohead" | '''SetRxMask'''
|-
|-
| colspan="2" | Set the Tx CAN ID as a generic number. Standard and extended IDs Standard 0-2047 Extended 2048-536870911 &nbsp;
| colspan="2" | Allows the receive ID mask to be configured on the fly allowing different ID ranges to be received.&nbsp;
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Buffer
| width="90%" | Mask
|-
|-
| colspan="2" | Transmit buffer to load. Range: 0-2&nbsp;
| colspan="2" | Specifies which receive mask to modify. Range: 0-1&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG
| width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG
| width="90%" | ID
| width="90%" | ID
|-
|-
| colspan="2" | The ID or Extended ID value you wish to use. Range: 0-536870911&nbsp;
| colspan="2" | The ID mask value you wish to use&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 360: Line 344:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===SetRxMaskID===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckRx'''
| width="90%" class="mtx-class-macrohead" | '''SetRxMaskID'''
|-
|-
| colspan="2" | Checks to see if any messages are available for 'Buffer' specified &nbsp;
| colspan="2" | set the Mask Standard ID mode only (for V5 compatibility) &nbsp;
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Buffer
| width="90%" | Mask
|-
| colspan="2" | Send buffer: 0  to 1&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ChangeRate'''
|-
| colspan="2" | Simple attempt to alter the bus rate of the CAN. External CAN channels only,&nbsp;
|-
|-
|-
| colspan="2" | Specifies which receive mask to modify. Range: 0-1&nbsp;
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Rate
|-
| colspan="2" | Rate: 0-3 where 0=125, 1=250, 2=500, 3=1000&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetRxIDSimple'''
|-
| colspan="2" | Gets the Rx ID as a Integer Standard ID only 0-2047.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Buffer
|-
| colspan="2" | Receive Buffer. Range 0-1&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetTxID'''
|-
| colspan="2" | Set the Tx CAN ID in register format. Standard ID only 0-2047. Compatible with v5 component and previous,&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Buffer
|-
| colspan="2" | Transmit buffer to load. Range: 0-2&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Hi
| width="90%" | Hi
|-
|-
| colspan="2" | ID bits 3-10 e.g. ((ID & 0x7F8) >> 3)&nbsp;
| colspan="2" | ID bits 3-10&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Lo
| width="90%" | Lo
|-
|-
| colspan="2" | ID bits 0-2 stored in the upper 3 bits of the byte e.g. ((ID & 0x7) << 5)&nbsp;
| colspan="2" | ID bits 0-2 stored in the upper 3 bits of the byte&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetRxIdent'''
|-
| colspan="2" | Gets the Rx ID as a Integer Standard and Extended IDs.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Buffer
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u32-icon.png]] - ULONG
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ShowLEDs'''
|-
| colspan="2" | Set LED state (External CAN only) &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | led1
|-
| colspan="2" | Controls LED 1. Range: 0-1&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | led2
|-
| colspan="2" | Controls LED 2. Range: 0-1&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 483: Line 373:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===SetTxData===
|-
{| class="mtx-class-macrotable wikitable"
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
|-
| colspan="2" | Must be called before any other CAN component macros to enable and initialise the CAN peripheral. &nbsp;
|-
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" class="mtx-class-macrohead" | '''SetTxData'''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
 
 
==Property reference==
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | SPI
|-
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | External/Internal
|-
| colspan="2" | Switches between Internal CAN peripheral and External CAN controller IC MCP2515.&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | CHANNEL
|-
| colspan="2" | SPI Channel selector&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-19-icon.png]]
| width="90%" | Port
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | INT
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | CS (SS)
|-
| colspan="2" | Chip Select / Slave Select Pin  Master Mode: General purpose output pin used to select the remote SPI device. Slave Mode: Hardware chip select pin input used to select the SPI device. &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | MOSI
|-
| colspan="2" | SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode.&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | MISO
|-
| colspan="2" | SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode.&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | CLK
|-
| colspan="2" | SPI Clock Pin CLK - The Clock signal is driven by the SPI master.&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Prescale
|-
| colspan="2" | Prescale option selector&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Sample Point
|-
| colspan="2" | Data bit read sample point&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Config Delay
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | TX Buffer 0
|-
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | Message ID
|-
| colspan="2" | TX Buffer 0 Message Identifier&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | Length
|-
| colspan="2" | TX Buffer 0 Number of data bytes&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D0
|-
| colspan="2" | TX Buffer 0 Data Byte 0&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D1
|-
| colspan="2" | TX Buffer 0 Data Byte 1&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D2
|-
| colspan="2" | TX Buffer 0 Data Byte 2&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D3
|-
| colspan="2" | TX Buffer 0 Data Byte 3&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D4
|-
| colspan="2" | TX Buffer 0 Data Byte 4&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D5
|-
| colspan="2" | TX Buffer 0 Data Byte 5&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D6
|-
| colspan="2" | TX Buffer 0 Data Byte 6&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D7
|-
| colspan="2" | TX Buffer 0 Data Byte 7&nbsp;
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | TX Buffer 1
|-
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | Message ID
|-
| colspan="2" | TX Buffer 1 Message Identifier&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | Length
|-
| colspan="2" | TX Buffer 1 Number of data bytes&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D0
|-
| colspan="2" | TX Buffer 1 Data Byte 0&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D1
|-
| colspan="2" | TX Buffer 1 Data Byte 1&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D2
|-
| colspan="2" | TX Buffer 1 Data Byte 2&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D3
|-
| colspan="2" | TX Buffer 1 Data Byte 3&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D4
|-
| colspan="2" | TX Buffer 1 Data Byte 4&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D5
|-
| colspan="2" | TX Buffer 1 Data Byte 5&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D6
|-
| colspan="2" | TX Buffer 1 Data Byte 6&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D7
|-
| colspan="2" | TX Buffer 1 Data Byte 7&nbsp;
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | TX Buffer 2
|-
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | Message ID
|-
| colspan="2" | TX Buffer 2 Message Identifier&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | Length
|-
| colspan="2" | TX Buffer 2 Number of data bytes&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D0
|-
| colspan="2" | TX Buffer 2 Data Byte 0&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D1
|-
| colspan="2" | TX Buffer 2 Data Byte 1&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D2
|-
| colspan="2" | TX Buffer 2 Data Byte 2&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D3
|-
| colspan="2" | TX Buffer 2 Data Byte 3&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D4
|-
| colspan="2" | TX Buffer 2 Data Byte 4&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D5
|-
| colspan="2" | TX Buffer 2 Data Byte 5&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D6
|-
| colspan="2" | TX Buffer 2 Data Byte 6&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | D7
|-
| colspan="2" | TX Buffer 2 Data Byte 7&nbsp;
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | RX Buffer 0
|-
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Settings
|-
| colspan="2" | RX Buffer 0 Message Receive Mode&nbsp;
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | RX Buffer 1
|-
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Settings
|-
| colspan="2" | RX Buffer 1 Message Receive Mode&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
| width="90%" | Simulate SPI Comms
|-
| colspan="2" | &nbsp;
|}==Macro reference==
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadSwitches'''
|-
| colspan="2" | Returns switch input states from the external MCP2515 device. 0 = No Switch Pressed, 1 = Switch 1 Pressed, 2 = Switch 2 Pressed, 3 = Both Pressed (External CAN only) &nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetTxData'''
|-
|-
| colspan="2" | Assigns one of the outgoing transmit buffers with data ready to be sent.&nbsp;
| colspan="2" | Assigns one of the outgoing transmit buffers with data ready to be sent.&nbsp;
Line 827: Line 437:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===SetTxID===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetRxMask'''
| width="90%" class="mtx-class-macrohead" | '''SetTxID'''
|-
|-
| colspan="2" | Allows the receive ID mask to be configured on the fly allowing different ID ranges to be received.&nbsp;
| colspan="2" | Set the Tx CAN ID in register format. Standard ID only 0-2047. Compatible with v5 component and previous,&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Mask
|-
| colspan="2" | Specifies which receive mask to modify. Range: 0-1&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG
| width="90%" | ID
|-
| colspan="2" | The ID mask value you wish to use&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetRxData'''
|-
| colspan="2" | Returns last received message data byte at position Index. Buffer parameter is currently ignored&nbsp;
|-
|-
|-
|-
Line 861: Line 449:
| width="90%" | Buffer
| width="90%" | Buffer
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | Transmit buffer to load. Range: 0-2&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Index
| width="90%" | Hi
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetRxIDHi'''
|-
| colspan="2" | Gets the Hi byte Rx ID in register format. Standard ID only 0-2047. Compatible with v5 component and previous, &nbsp;
|-
|-
| colspan="2" | ID bits 3-10 e.g. ((ID & 0x7F8) >> 3)&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Buffer
| width="90%" | Lo
|-
|-
| colspan="2" | Receive Buffer. Range 0-1&nbsp;
| colspan="2" | ID bits 0-2 stored in the upper 3 bits of the byte e.g. ((ID & 0x7) << 5)&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===SetTxIDSimple===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetTxIDSimple'''
| width="90%" class="mtx-class-macrohead" | '''SetTxIDSimple'''
|-
|-
| colspan="2" | Set the Tx CAN ID as a generic number. Standard IDs only 0-2047. &nbsp;
| colspan="2" | Set the Tx CAN ID as a generic number. Standard IDs only 0-2047. &nbsp;
Line 914: Line 490:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===SetTxIdent===
|-
{| class="mtx-class-macrotable wikitable"
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendBuffer'''
|-
| colspan="2" | Transmits one of the transmit buffers which should have already been populated with an ID and data.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Buffer
|-
| colspan="2" | Specifies which transmit buffer to send&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetRxDataCount'''
|-
| colspan="2" | Returns last received message data length. Buffer parameter is currently ignored&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Buffer
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetRxFilterID'''
|-
| colspan="2" | sets the Filter Standard mode only  (for V5 compatibility only)&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Filter
|-
| colspan="2" | Specifies which filter to modify. Range: 0-5&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Hi
|-
| colspan="2" | ID bits 3-10&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Lo
|-
| colspan="2" | ID bits 0-2 stored in the upper 3 bits of the byte&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetRxIDLo'''
|-
| colspan="2" | Gets the Lo byte Rx ID in register format. Standard ID only 0-2047. Compatible with v5 component and previous, &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Buffer
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetRxFilter'''
|-
| colspan="2" | Allows the receive ID filter to be configured on the fly allowing different ID ranges to be received.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Filter
|-
| colspan="2" | Specifies which receive filter to modify. Range: 0-5&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG
| width="90%" | ID
|-
| colspan="2" | The ID filter value you wish to use&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetRxMaskID'''
|-
| colspan="2" | set the Mask Standard ID mode only (for V5 compatibility) &nbsp;
|-
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" class="mtx-class-macrohead" | '''SetTxIdent'''
| width="90%" | Mask
|-
| colspan="2" | Specifies which receive mask to modify. Range: 0-1&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Hi
|-
| colspan="2" | ID bits 3-10&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Lo
|-
| colspan="2" | ID bits 0-2 stored in the upper 3 bits of the byte&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetTxIdent'''
|-
|-
| colspan="2" | Set the Tx CAN ID as a generic number. Standard and extended IDs Standard 0-2047 Extended 2048-536870911 &nbsp;
| colspan="2" | Set the Tx CAN ID as a generic number. Standard and extended IDs Standard 0-2047 Extended 2048-536870911 &nbsp;
Line 1,070: Line 514:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===ShowLEDs===
|-
{| class="mtx-class-macrotable wikitable"
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckRx'''
|-
| colspan="2" | Checks to see if any messages are available for 'Buffer' specified &nbsp;
|-
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" class="mtx-class-macrohead" | '''ShowLEDs'''
| width="90%" | Buffer
|-
| colspan="2" | Send buffer: 0  to 1&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ChangeRate'''
|-
| colspan="2" | Simple attempt to alter the bus rate of the CAN. External CAN channels only,&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Rate
|-
| colspan="2" | Rate: 0-3 where 0=125, 1=250, 2=500, 3=1000&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetRxIDSimple'''
|-
| colspan="2" | Gets the Rx ID as a Integer Standard ID only 0-2047.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Buffer
|-
| colspan="2" | Receive Buffer. Range 0-1&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetTxID'''
|-
| colspan="2" | Set the Tx CAN ID in register format. Standard ID only 0-2047. Compatible with v5 component and previous,&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Buffer
|-
| colspan="2" | Transmit buffer to load. Range: 0-2&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Hi
|-
| colspan="2" | ID bits 3-10 e.g. ((ID & 0x7F8) >> 3)&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Lo
|-
| colspan="2" | ID bits 0-2 stored in the upper 3 bits of the byte e.g. ((ID & 0x7) << 5)&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetRxIdent'''
|-
| colspan="2" | Gets the Rx ID as a Integer Standard and Extended IDs.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Buffer
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u32-icon.png]] - ULONG
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ShowLEDs'''
|-
|-
| colspan="2" | Set LED state (External CAN only) &nbsp;
| colspan="2" | Set LED state (External CAN only) &nbsp;
Line 1,191: Line 536:
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
|-
| colspan="2" | Must be called before any other CAN component macros to enable and initialise the CAN peripheral. &nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




==Property reference==
==Property reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
| width="90%" class="mtx-class-macrohead" | '''Properties'''  
|-
|-
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | SPI
| width="90%" class="mtx-class-propfolder" | SPI
|-
|-
|-
|-
Line 1,275: Line 605:
| colspan="2" | &nbsp;
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | TX Buffer 0
| width="90%" class="mtx-class-propfolder" | TX Buffer 0
|-
|-
|-
|-
Line 1,329: Line 659:
| colspan="2" | TX Buffer 0 Data Byte 7&nbsp;
| colspan="2" | TX Buffer 0 Data Byte 7&nbsp;
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | TX Buffer 1
| width="90%" class="mtx-class-propfolder" | TX Buffer 1
|-
|-
|-
|-
Line 1,383: Line 713:
| colspan="2" | TX Buffer 1 Data Byte 7&nbsp;
| colspan="2" | TX Buffer 1 Data Byte 7&nbsp;
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | TX Buffer 2
| width="90%" class="mtx-class-propfolder" | TX Buffer 2
|-
|-
|-
|-
Line 1,437: Line 767:
| colspan="2" | TX Buffer 2 Data Byte 7&nbsp;
| colspan="2" | TX Buffer 2 Data Byte 7&nbsp;
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | RX Buffer 0
| width="90%" class="mtx-class-propfolder" | RX Buffer 0
|-
|-
|-
|-
Line 1,446: Line 776:
| colspan="2" | RX Buffer 0 Message Receive Mode&nbsp;
| colspan="2" | RX Buffer 0 Message Receive Mode&nbsp;
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | RX Buffer 1
| width="90%" class="mtx-class-propfolder" | RX Buffer 1
|-
|-
|-
|-
Line 1,460: Line 790:
| colspan="2" | &nbsp;
| colspan="2" | &nbsp;
|}
|}
==Component Source Code==
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_EBlocks2_CAN_Bus_BL0140_2d.fcfx FC_Comp_Source_EBlocks2_CAN_Bus_BL0140_2d.fcfx]
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_EBlocks2_CAN_Bus_BL0140_2d.fcfx FC_Comp_Source_EBlocks2_CAN_Bus_BL0140_2d.fcfx]

Latest revision as of 14:36, 13 July 2026

Author
Version 1.0
Category E-blocks 2


CAN_Bus_BL0140 component

Detailed description

No detailed description exists yet for this component

Examples

No additional examples








Macro reference

ChangeRate

ChangeRate
Simple attempt to alter the bus rate of the CAN. External CAN channels only, 
- BYTE Rate
Rate: 0-3 where 0=125, 1=250, 2=500, 3=1000 
- VOID Return


CheckRx

CheckRx
Checks to see if any messages are available for 'Buffer' specified  
- BYTE Buffer
Send buffer: 0 to 1 
- BYTE Return


GetRxData

GetRxData
Returns last received message data byte at position Index. Buffer parameter is currently ignored 
- BYTE Buffer
 
- BYTE Index
 
- BYTE Return


GetRxDataCount

GetRxDataCount
Returns last received message data length. Buffer parameter is currently ignored 
- BYTE Buffer
 
- BYTE Return


GetRxIDHi

GetRxIDHi
Gets the Hi byte Rx ID in register format. Standard ID only 0-2047. Compatible with v5 component and previous,  
- BYTE Buffer
Receive Buffer. Range 0-1 
- BYTE Return


GetRxIDLo

GetRxIDLo
Gets the Lo byte Rx ID in register format. Standard ID only 0-2047. Compatible with v5 component and previous,  
- BYTE Buffer
 
- BYTE Return


GetRxIDSimple

GetRxIDSimple
Gets the Rx ID as a Integer Standard ID only 0-2047. 
- BYTE Buffer
Receive Buffer. Range 0-1 
- UINT Return


GetRxIdent

GetRxIdent
Gets the Rx ID as a Integer Standard and Extended IDs. 
- BYTE Buffer
 
- ULONG Return


Initialise

Initialise
Must be called before any other CAN component macros to enable and initialise the CAN peripheral.  
- VOID Return


ReadSwitches

ReadSwitches
Returns switch input states from the external MCP2515 device. 0 = No Switch Pressed, 1 = Switch 1 Pressed, 2 = Switch 2 Pressed, 3 = Both Pressed (External CAN only)  
- BYTE Return


SendBuffer

SendBuffer
Transmits one of the transmit buffers which should have already been populated with an ID and data. 
- BYTE Buffer
Specifies which transmit buffer to send 
- VOID Return


SetRxFilter

SetRxFilter
Allows the receive ID filter to be configured on the fly allowing different ID ranges to be received. 
- BYTE Filter
Specifies which receive filter to modify. Range: 0-5 
- ULONG ID
The ID filter value you wish to use 
- VOID Return


SetRxFilterID

SetRxFilterID
sets the Filter Standard mode only (for V5 compatibility only) 
- BYTE Filter
Specifies which filter to modify. Range: 0-5 
- BYTE Hi
ID bits 3-10 
- BYTE Lo
ID bits 0-2 stored in the upper 3 bits of the byte 
- VOID Return


SetRxMask

SetRxMask
Allows the receive ID mask to be configured on the fly allowing different ID ranges to be received. 
- BYTE Mask
Specifies which receive mask to modify. Range: 0-1 
- ULONG ID
The ID mask value you wish to use 
- VOID Return


SetRxMaskID

SetRxMaskID
set the Mask Standard ID mode only (for V5 compatibility)  
- BYTE Mask
Specifies which receive mask to modify. Range: 0-1 
- BYTE Hi
ID bits 3-10 
- BYTE Lo
ID bits 0-2 stored in the upper 3 bits of the byte 
- VOID Return


SetTxData

SetTxData
Assigns one of the outgoing transmit buffers with data ready to be sent. 
- BYTE Buffer
 
- BYTE Count
 
- BYTE d0
 
- BYTE d1
 
- BYTE d2
 
- BYTE d3
 
- BYTE d4
 
- BYTE d5
 
- BYTE d6
 
- BYTE d7
 
- VOID Return


SetTxID

SetTxID
Set the Tx CAN ID in register format. Standard ID only 0-2047. Compatible with v5 component and previous, 
- BYTE Buffer
Transmit buffer to load. Range: 0-2 
- BYTE Hi
ID bits 3-10 e.g. ((ID & 0x7F8) >> 3) 
- BYTE Lo
ID bits 0-2 stored in the upper 3 bits of the byte e.g. ((ID & 0x7) << 5) 
- VOID Return


SetTxIDSimple

SetTxIDSimple
Set the Tx CAN ID as a generic number. Standard IDs only 0-2047.  
- BYTE Buffer
Transmit buffer to load. Range: 0-2 
- UINT ID
The ID value you wish to use. Range: 0-2047 
- VOID Return


SetTxIdent

SetTxIdent
Set the Tx CAN ID as a generic number. Standard and extended IDs Standard 0-2047 Extended 2048-536870911  
- BYTE Buffer
Transmit buffer to load. Range: 0-2 
- ULONG ID
The ID or Extended ID value you wish to use. Range: 0-536870911 
- VOID Return


ShowLEDs

ShowLEDs
Set LED state (External CAN only)  
- BYTE led1
Controls LED 1. Range: 0-1 
- BYTE led2
Controls LED 2. Range: 0-1 
- VOID Return


Property reference

Properties
SPI
External/Internal
Switches between Internal CAN peripheral and External CAN controller IC MCP2515. 
CHANNEL
SPI Channel selector 
Port
 
INT
 
CS (SS)
Chip Select / Slave Select Pin Master Mode: General purpose output pin used to select the remote SPI device. Slave Mode: Hardware chip select pin input used to select the SPI device.  
MOSI
SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode. 
MISO
SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode. 
CLK
SPI Clock Pin CLK - The Clock signal is driven by the SPI master. 
Prescale
Prescale option selector 
Sample Point
Data bit read sample point 
Config Delay
 
TX Buffer 0
Message ID
TX Buffer 0 Message Identifier 
Length
TX Buffer 0 Number of data bytes 
D0
TX Buffer 0 Data Byte 0 
D1
TX Buffer 0 Data Byte 1 
D2
TX Buffer 0 Data Byte 2 
D3
TX Buffer 0 Data Byte 3 
D4
TX Buffer 0 Data Byte 4 
D5
TX Buffer 0 Data Byte 5 
D6
TX Buffer 0 Data Byte 6 
D7
TX Buffer 0 Data Byte 7 
TX Buffer 1
Message ID
TX Buffer 1 Message Identifier 
Length
TX Buffer 1 Number of data bytes 
D0
TX Buffer 1 Data Byte 0 
D1
TX Buffer 1 Data Byte 1 
D2
TX Buffer 1 Data Byte 2 
D3
TX Buffer 1 Data Byte 3 
D4
TX Buffer 1 Data Byte 4 
D5
TX Buffer 1 Data Byte 5 
D6
TX Buffer 1 Data Byte 6 
D7
TX Buffer 1 Data Byte 7 
TX Buffer 2
Message ID
TX Buffer 2 Message Identifier 
Length
TX Buffer 2 Number of data bytes 
D0
TX Buffer 2 Data Byte 0 
D1
TX Buffer 2 Data Byte 1 
D2
TX Buffer 2 Data Byte 2 
D3
TX Buffer 2 Data Byte 3 
D4
TX Buffer 2 Data Byte 4 
D5
TX Buffer 2 Data Byte 5 
D6
TX Buffer 2 Data Byte 6 
D7
TX Buffer 2 Data Byte 7 
RX Buffer 0
Settings
RX Buffer 0 Message Receive Mode 
RX Buffer 1
Settings
RX Buffer 1 Message Receive Mode 
Simulate SPI Comms
 

Component Source Code

Please click here to download the component source project: FC_Comp_Source_EBlocks2_CAN_Bus_BL0140_2d.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_EBlocks2_CAN_Bus_BL0140_2d.fcfx