Component: CAN (CAL) (Misc): Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 15: | Line 15: | ||
CAL = Code Abstraction Layer - Allows one code base to run on a wide range of chips. Low level routines for controling the internal CAN peripheral. | CAL = Code Abstraction Layer - Allows one code base to run on a wide range of chips. Low level routines for controling the internal CAN peripheral. | ||
==Component | ==Component Source Code== | ||
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_CAN.fcfx FC_Comp_Source_CAN.fcfx] | |||
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_CAN.fcfx FC_Comp_Source_CAN.fcfx] | |||
==Detailed description== | ==Detailed description== | ||
| Line 942: | Line 944: | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Simulations''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Simulations''' | ||
|- | |- | ||
|} | |||
==Macro reference== | |||
===CheckRx=== | |||
{| 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;" | '''CheckRx''' | |||
|- | |||
| colspan="2" | Checks to see if any messages are available for 'Buffer' specified | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Buffer | |||
|- | |||
| colspan="2" | Send buffer: 0 to 1 | |||
|- | |||
| 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'' | |||
|} | |||
===GetList=== | |||
{| 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;" | '''GetList''' | |||
|- | |||
| colspan="2" | Get the Filter List of the Named Property | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | |||
| width="90%" | Name | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING | |||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | |||
|} | |||
===GetRxData=== | |||
{| 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 the data byte at index from the buffer specified | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | buffer | |||
|- | |||
| colspan="2" | The index of the required buffer | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | index | |||
|- | |||
| colspan="2" | The index of the required data byte in the buffer | |||
|- | |||
| 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'' | |||
|} | |||
===GetRxDataCount=== | |||
{| 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 the number of valid data bytes in the buffer | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | buffer | |||
|- | |||
| colspan="2" | The index of the required buffer | |||
|- | |||
| 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'' | |||
|} | |||
===GetRxIdent=== | |||
{| 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" | Generic function to get the received message Identifier. | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | buffer | |||
|- | |||
| colspan="2" | | |||
|- | |||
| 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'' | |||
|} | |||
===GetValue=== | |||
{| 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;" | '''GetValue''' | |||
|- | |||
| colspan="2" | Get the Value of the Named property | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | |||
| width="90%" | Name | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING | |||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | |||
|} | |||
===Init=== | |||
{| 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;" | '''Init''' | |||
|- | |||
| colspan="2" | Must be called at least once and after every Uninit call to enable the CAN instance | |||
|- | |||
|- | |||
| 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'' | |||
|} | |||
===InitRXConfig=== | |||
{| 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;" | '''InitRXConfig''' | |||
|- | |||
| colspan="2" | Initialization setting for RX Buffer Config | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Buffer | |||
|- | |||
| colspan="2" | Buffer Number (0 or 1) | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Value | |||
|- | |||
| colspan="2" | Config data 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'' | |||
|} | |||
===InitRXFilter=== | |||
{| 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;" | '''InitRXFilter''' | |||
|- | |||
| colspan="2" | Initialization setting for RX Filter | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Filter | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG | |||
| width="90%" | Value | |||
|- | |||
| colspan="2" | | |||
|- | |||
| 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'' | |||
|} | |||
===InitRXMask=== | |||
{| 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;" | '''InitRXMask''' | |||
|- | |||
| colspan="2" | Initialization setting for RX Mask | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Mask | |||
|- | |||
| colspan="2" | Mask Number (0 or 1) | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG | |||
| width="90%" | Value | |||
|- | |||
| colspan="2" | | |||
|- | |||
| 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'' | |||
|} | |||
===InitTXBuffer=== | |||
{| 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;" | '''InitTXBuffer''' | |||
|- | |||
| colspan="2" | Initialization settings for TX Buffers | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Buffer | |||
|- | |||
| colspan="2" | TX Buffer ID = 0,1 or 2 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG | |||
| width="90%" | ID | |||
|- | |||
| colspan="2" | CAN Address | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Length | |||
|- | |||
| colspan="2" | Number of bytes to send | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | |||
| width="90%" | Data | |||
|- | |||
| colspan="2" | Data Array (of Length bytes) | |||
|- | |||
| 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'' | |||
|} | |||
===SendBuffer=== | |||
{| 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;" | '''SendBuffer''' | |||
|- | |||
| colspan="2" | Sends the contents of the buffer previously filled with Set_TX_... calls | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Buffer | |||
|- | |||
| colspan="2" | Send buffer: 0 to,2 | |||
|- | |||
| 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'' | |||
|} | |||
===SetRxFilter=== | |||
{| 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" | Generic function to set Identifier. CAN registers will be configured depending upon Std/Ext mode setting. | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | filter | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG | |||
| width="90%" | id | |||
|- | |||
| colspan="2" | | |||
|- | |||
| 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'' | |||
|} | |||
===SetRxFilterExd=== | |||
{| 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;" | '''SetRxFilterExd''' | |||
|- | |||
| colspan="2" | Sets the 32-bit filter as a bit-mask of the extended ID for received messages The messages are accepted if (ExtID & Mask) == Filter | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Filter | |||
|- | |||
| colspan="2" | Send filter: 0 to 3 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | ID3 | |||
|- | |||
| colspan="2" | The high byte (bits 24-31) of the ID | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | ID2 | |||
|- | |||
| colspan="2" | The mid-high byte (bits 16-23) of the ID | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | ID1 | |||
|- | |||
| colspan="2" | The mid-low byte (bits 8-15) of the ID | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | ID0 | |||
|- | |||
| colspan="2" | The low byte (bits 0-7) of the ID | |||
|- | |||
| 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'' | |||
|} | |||
===SetRxFilterStd=== | |||
{| 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;" | '''SetRxFilterStd''' | |||
|- | |||
| colspan="2" | Sets the 16-bit filter as a bit-mask of the standard ID for received messages The messages are accepted if (StdID & Mask) == Filter | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Filter | |||
|- | |||
| colspan="2" | Filter number | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Hi | |||
|- | |||
| colspan="2" | The high byte (bits 8-15) of the ID | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Lo | |||
|- | |||
| colspan="2" | The low byte (bits 0-7) of the ID | |||
|- | |||
| 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'' | |||
|} | |||
===SetRxMask=== | |||
{| 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;" | '''SetRxMask''' | |||
|- | |||
| colspan="2" | Generic function to set Identifier. CAN registers will be configured depending upon Std/Ext mode setting. | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | mask | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG | |||
| width="90%" | id | |||
|- | |||
| colspan="2" | | |||
|- | |||
| 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'' | |||
|} | |||
===SetRxMaskExd=== | |||
{| 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;" | '''SetRxMaskExd''' | |||
|- | |||
| colspan="2" | Sets the 32-bit filter as a bit-mask of the extended ID for received messages The messages are accepted if (ExtID & Mask) == Filter | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Mask | |||
|- | |||
| colspan="2" | Mask 0 or 1 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | ID3 | |||
|- | |||
| colspan="2" | The high byte (bits 24-31) of the ID | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | ID2 | |||
|- | |||
| colspan="2" | The mid-high byte (bits 16-23) of the ID | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | ID1 | |||
|- | |||
| colspan="2" | The mid-low byte (bits 8-15) of the ID | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | ID0 | |||
|- | |||
| colspan="2" | The low byte (bits 0-7) of the ID | |||
|- | |||
| 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'' | |||
|} | |||
===SetRxMaskStd=== | |||
{| 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;" | '''SetRxMaskStd''' | |||
|- | |||
| colspan="2" | Sets the 16-bit filter as a bit-mask of the standard ID for received messages The messages are accepted if (StdID & Mask) == Filter | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Mask | |||
|- | |||
| colspan="2" | Mask number | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Hi | |||
|- | |||
| colspan="2" | The high byte (bits 8-15) of the ID | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Lo | |||
|- | |||
| colspan="2" | The low byte (bits 0-7) of the ID | |||
|- | |||
| 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'' | |||
|} | |||
===SetTxData=== | |||
{| 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" | Sets the CAN transmit data for the buffer specified (0, 1 or 2). The count parameter Data_Cnt indicates the number of valid data bytes. D0 to D7 are the payload data bytes to be loaded into the transmit buffer. | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Buffer | |||
|- | |||
| colspan="2" | Send buffer: 0 to,2 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Data_Cnt | |||
|- | |||
| colspan="2" | The number of bytes of data to add, 0 to 8 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | D0 | |||
|- | |||
| colspan="2" | Data byte 0 to add | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | D1 | |||
|- | |||
| colspan="2" | Data byte 1 to add | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | D2 | |||
|- | |||
| colspan="2" | Data byte 2 to add | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | D3 | |||
|- | |||
| colspan="2" | Data byte 3 to add | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | D4 | |||
|- | |||
| colspan="2" | Data byte 4 to add | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | D5 | |||
|- | |||
| colspan="2" | Data byte 5 to add | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | D6 | |||
|- | |||
| colspan="2" | Data byte 6 to add | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | D7 | |||
|- | |||
| colspan="2" | Data byte 7 to add | |||
|- | |||
| 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'' | |||
|} | |||
===SetTxIdent=== | |||
{| 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" | Generic function to set Identifier. CAN registers will be configured depending upon Std/Ext mode setting. | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | buffer | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG | |||
| width="90%" | id | |||
|- | |||
| colspan="2" | | |||
|- | |||
| 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'' | |||
|} | |||
===SetTxIdentExd=== | |||
{| 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;" | '''SetTxIdentExd''' | |||
|- | |||
| colspan="2" | Sets the optional 32-bit ID to send along with the standard ID and data in the next CAN message | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Buffer | |||
|- | |||
| colspan="2" | Send buffer: 0 to,2 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | ID3 | |||
|- | |||
| colspan="2" | The high byte (bits 24-31) of the ID | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | ID2 | |||
|- | |||
| colspan="2" | The mid-high byte (bits 16-23) of the ID | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | ID1 | |||
|- | |||
| colspan="2" | The mid-low byte (bits 8-15) of the ID | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | ID0 | |||
|- | |||
| colspan="2" | The low byte (bits 0-7) of the ID | |||
|- | |||
| 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'' | |||
|} | |||
===SetTxIdentStd=== | |||
{| 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;" | '''SetTxIdentStd''' | |||
|- | |||
| colspan="2" | Sets the ID to send along with the data in the next CAN message | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Buffer | |||
|- | |||
| colspan="2" | Send buffer: 0 to,2 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Hi | |||
|- | |||
| colspan="2" | The high byte (bits 8-15) of the ID | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Lo | |||
|- | |||
| colspan="2" | The low byte (bits 0-7) of the ID | |||
|- | |||
| 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'' | |||
|} | |||
===SetValue=== | |||
{| 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;" | '''SetValue''' | |||
|- | |||
| colspan="2" | Set the Value of the Named property | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | |||
| width="90%" | Name | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | |||
| width="90%" | Value | |||
|- | |||
| colspan="2" | | |||
|- | |||
| 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'' | |||
|} | |||
===Uninit=== | |||
{| 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;" | '''Uninit''' | |||
|- | |||
| colspan="2" | Uninitialises the CAN, freeing its connections for general use | |||
|- | |||
|- | |||
| 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== | |||
{| 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" | [[File:Fc9-type-16-icon.png]] | |||
| width="90%" | Channel | |||
|- | |||
| colspan="2" | Selects the CAN channel to be used | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]] | |||
| width="90%" | TX Pin | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]] | |||
| width="90%" | RX Pin | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |||
| width="90%" | TX Remap | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |||
| width="90%" | RX Remap | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |||
| width="90%" | Bus Rate | |||
|- | |||
| colspan="2" | selects the Bus Rate (KHz) | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |||
| width="90%" | Sample Point | |||
|- | |||
| colspan="2" | selects the Sample Point for bit reading | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |||
| width="90%" | SJW | |||
|- | |||
| colspan="2" | Synchronization Jump Width adjusts the bit clock by 1 to 4 TQ periods | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | Fosc | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | BRGCON1 | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | BRGCON2 | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | BRGCON3 | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |||
| width="90%" | ID Type | |||
|- | |||
| colspan="2" | selects the CAN ID type | |||
|- | |||
| 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" | CAN Message ID for Transmit Buffer 0 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | Length | |||
|- | |||
| colspan="2" | Number of valid data bytes in the message | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D0 | |||
|- | |||
| colspan="2" | Data byte 0 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D1 | |||
|- | |||
| colspan="2" | Data byte 1 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D2 | |||
|- | |||
| colspan="2" | Data byte 2 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D3 | |||
|- | |||
| colspan="2" | Data byte 3 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D4 | |||
|- | |||
| colspan="2" | Data byte 4 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D5 | |||
|- | |||
| colspan="2" | Data byte 5 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D6 | |||
|- | |||
| colspan="2" | Data byte 6 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D7 | |||
|- | |||
| colspan="2" | Data byte 7 | |||
|- | |||
| 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" | CAN Message ID for Transmit Buffer 1 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | Length | |||
|- | |||
| colspan="2" | Number of valid data bytes in the message | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D0 | |||
|- | |||
| colspan="2" | Data byte 0 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D1 | |||
|- | |||
| colspan="2" | Data byte 1 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D2 | |||
|- | |||
| colspan="2" | Data byte 2 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D3 | |||
|- | |||
| colspan="2" | Data byte 3 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D4 | |||
|- | |||
| colspan="2" | Data byte 4 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D5 | |||
|- | |||
| colspan="2" | Data byte 5 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D6 | |||
|- | |||
| colspan="2" | Data byte 6 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D7 | |||
|- | |||
| colspan="2" | Data byte 7 | |||
|- | |||
| 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" | CAN Message ID for Transmit Buffer 2 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | Length | |||
|- | |||
| colspan="2" | Number of valid data bytes in the message | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D0 | |||
|- | |||
| colspan="2" | Data byte 0 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D1 | |||
|- | |||
| colspan="2" | Data byte 1 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D2 | |||
|- | |||
| colspan="2" | Data byte 2 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D3 | |||
|- | |||
| colspan="2" | Data byte 3 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D4 | |||
|- | |||
| colspan="2" | Data byte 4 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D5 | |||
|- | |||
| colspan="2" | Data byte 5 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D6 | |||
|- | |||
| colspan="2" | Data byte 6 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | D7 | |||
|- | |||
| colspan="2" | Data byte 7 | |||
|- | |||
| 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" | Filter setting for Receive Buffer 0 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | Mask | |||
|- | |||
| colspan="2" | Value for Receive Mask 0 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | Filter 0 | |||
|- | |||
| colspan="2" | Value for Filter 0 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | Filter 1 | |||
|- | |||
| colspan="2" | Value for Filter 1 | |||
|- | |||
| 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" | Filter setting for Receive Buffer 1 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | Mask | |||
|- | |||
| colspan="2" | Value for Receive Mask 1 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | Filter 2 | |||
|- | |||
| colspan="2" | Value for Filter 2 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | Filter 3 | |||
|- | |||
| colspan="2" | Value for Filter 3 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | Filter 4 | |||
|- | |||
| colspan="2" | Value for Filter 4 | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | Filter 5 | |||
|- | |||
| colspan="2" | Value for Filter 5 | |||
|} | |} | ||
Revision as of 10:23, 24 February 2023
| Author | Matrix TSL |
| Version | 2.4 |
| Category | Misc |
CAN component
CAL = Code Abstraction Layer - Allows one code base to run on a wide range of chips. Low level routines for controling the internal CAN peripheral.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_CAN.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_CAN.fcfx
Detailed description
No detailed description exists yet for this component
Examples
Example showing how to build a component using a CAL component Using CAL Components.
Downloadable macro reference
| SetRxMask | |
| Generic function to set Identifier. CAN registers will be configured depending upon Std/Ext mode setting. | |
| mask | |
| id | |
| Return | |
| GetValue | |
| Get the Value of the Named property | |
| Name | |
| Return | |
| GetRxData | |
| Returns the data byte at index from the buffer specified | |
| buffer | |
| The index of the required buffer | |
| index | |
| The index of the required data byte in the buffer | |
| Return | |
| InitRXMask | |
| Initialization setting for RX Mask | |
| Mask | |
| Mask Number (0 or 1) | |
| Value | |
| Return | |
| SendBuffer | |
| Sends the contents of the buffer previously filled with Set_TX_... calls | |
| Buffer | |
| Send buffer: 0 to,2 | |
| Return | |
| InitRXFilter | |
| Initialization setting for RX Filter | |
| Filter | |
| Value | |
| Return | |
| GetRxDataCount | |
| Returns the number of valid data bytes in the buffer | |
| buffer | |
| The index of the required buffer | |
| Return | |
| Init | |
| Must be called at least once and after every Uninit call to enable the CAN instance | |
| Return | |
| SetValue | |
| Set the Value of the Named property | |
| Name | |
| Value | |
| Return | |
| SetRxFilter | |
| Generic function to set Identifier. CAN registers will be configured depending upon Std/Ext mode setting. | |
| filter | |
| id | |
| Return | |
| SetTxIdent | |
| Generic function to set Identifier. CAN registers will be configured depending upon Std/Ext mode setting. | |
| buffer | |
| id | |
| Return | |
| CheckRx | |
| Checks to see if any messages are available for 'Buffer' specified | |
| Buffer | |
| Send buffer: 0 to 1 | |
| Return | |
| InitRXConfig | |
| Initialization setting for RX Buffer Config | |
| Buffer | |
| Buffer Number (0 or 1) | |
| Value | |
| Config data byte | |
| Return | |
| Uninit | |
| Uninitialises the CAN, freeing its connections for general use | |
| Return | |
| GetList | |
| Get the Filter List of the Named Property | |
| Name | |
| Return | |
| GetRxIdent | |
| Generic function to get the received message Identifier. | |
| buffer | |
| Return | |
Property reference
Macro reference
CheckRx
| CheckRx | |
| Checks to see if any messages are available for 'Buffer' specified | |
| Buffer | |
| Send buffer: 0 to 1 | |
| Return | |
GetList
| GetList | |
| Get the Filter List of the Named Property | |
| Name | |
| Return | |
GetRxData
| GetRxData | |
| Returns the data byte at index from the buffer specified | |
| buffer | |
| The index of the required buffer | |
| index | |
| The index of the required data byte in the buffer | |
| Return | |
GetRxDataCount
| GetRxDataCount | |
| Returns the number of valid data bytes in the buffer | |
| buffer | |
| The index of the required buffer | |
| Return | |
GetRxIdent
| GetRxIdent | |
| Generic function to get the received message Identifier. | |
| buffer | |
| Return | |
GetValue
| GetValue | |
| Get the Value of the Named property | |
| Name | |
| Return | |
Init
| Init | |
| Must be called at least once and after every Uninit call to enable the CAN instance | |
| Return | |
InitRXConfig
| InitRXConfig | |
| Initialization setting for RX Buffer Config | |
| Buffer | |
| Buffer Number (0 or 1) | |
| Value | |
| Config data byte | |
| Return | |
InitRXFilter
| InitRXFilter | |
| Initialization setting for RX Filter | |
| Filter | |
| Value | |
| Return | |
InitRXMask
| InitRXMask | |
| Initialization setting for RX Mask | |
| Mask | |
| Mask Number (0 or 1) | |
| Value | |
| Return | |
InitTXBuffer
SendBuffer
| SendBuffer | |
| Sends the contents of the buffer previously filled with Set_TX_... calls | |
| Buffer | |
| Send buffer: 0 to,2 | |
| Return | |
SetRxFilter
| SetRxFilter | |
| Generic function to set Identifier. CAN registers will be configured depending upon Std/Ext mode setting. | |
| filter | |
| id | |
| Return | |
SetRxFilterExd
SetRxFilterStd
SetRxMask
| SetRxMask | |
| Generic function to set Identifier. CAN registers will be configured depending upon Std/Ext mode setting. | |
| mask | |
| id | |
| Return | |
SetRxMaskExd
SetRxMaskStd
SetTxData
SetTxIdent
| SetTxIdent | |
| Generic function to set Identifier. CAN registers will be configured depending upon Std/Ext mode setting. | |
| buffer | |
| id | |
| Return | |
SetTxIdentExd
SetTxIdentStd
SetValue
| SetValue | |
| Set the Value of the Named property | |
| Name | |
| Value | |
| Return | |
Uninit
| Uninit | |
| Uninitialises the CAN, freeing its connections for general use | |
| Return | |