Jump to content

Component: CAN (CAL) (Misc): Difference between revisions

From Flowcode Help
No edit summary
No edit summary
Line 14: Line 14:
==CAN component==
==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.
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 Pack==
COMMSA


==Detailed description==
==Detailed description==




Line 26: Line 32:


==Examples==
==Examples==





Revision as of 16:16, 7 January 2022

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 Pack

COMMSA

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

SetTxIdentStd
Sets the ID to send along with the data in the next CAN message  
- BYTE Buffer
Send buffer: 0 to,2 
- BYTE Hi
The high byte (bits 8-15) of the ID 
- BYTE Lo
The low byte (bits 0-7) of the ID 
- VOID Return


SetTxIdentExd
Sets the optional 32-bit ID to send along with the standard ID and data in the next CAN message  
- BYTE Buffer
Send buffer: 0 to,2 
- BYTE ID3
The high byte (bits 24-31) of the ID 
- BYTE ID2
The mid-high byte (bits 16-23) of the ID 
- BYTE ID1
The mid-low byte (bits 8-15) of the ID 
- BYTE ID0
The low byte (bits 0-7) of the ID 
- VOID Return


SetTxData
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. 
- BYTE Buffer
Send buffer: 0 to,2 
- BYTE Data_Cnt
The number of bytes of data to add, 0 to 8 
- BYTE D0
Data byte 0 to add 
- BYTE D1
Data byte 1 to add 
- BYTE D2
Data byte 2 to add 
- BYTE D3
Data byte 3 to add 
- BYTE D4
Data byte 4 to add 
- BYTE D5
Data byte 5 to add 
- BYTE D6
Data byte 6 to add 
- BYTE D7
Data byte 7 to add 
- VOID Return


SetRxMask
Generic function to set Identifier. CAN registers will be configured depending upon Std/Ext mode setting.  
- BYTE mask
 
- ULONG id
 
- VOID Return


GetValue
Get the Value of the Named property 
- STRING Name
 
- STRING Return


GetRxData
Returns the data byte at index from the buffer specified 
- BYTE buffer
The index of the required buffer 
- BYTE index
The index of the required data byte in the buffer 
- BYTE Return


InitRXMask
Initialization setting for RX Mask 
- BYTE Mask
Mask Number (0 or 1) 
- ULONG Value
 
- VOID Return


SendBuffer
Sends the contents of the buffer previously filled with Set_TX_... calls  
- BYTE Buffer
Send buffer: 0 to,2 
- VOID Return


InitRXFilter
Initialization setting for RX Filter 
- BYTE Filter
 
- ULONG Value
 
- VOID Return


GetRxDataCount
Returns the number of valid data bytes in the buffer 
- BYTE buffer
The index of the required buffer 
- BYTE Return


Init
Must be called at least once and after every Uninit call to enable the CAN instance  
- VOID Return


InitTXBuffer
Initialization settings for TX Buffers 
- BYTE Buffer
TX Buffer ID = 0,1 or 2 
- ULONG ID
CAN Address 
- BYTE Length
Number of bytes to send 
- STRING Data
Data Array (of Length bytes) 
- VOID Return


SetRxMaskStd
Sets the 16-bit filter as a bit-mask of the standard ID for received messages The messages are accepted if (StdID & Mask) == Filter  
- BYTE Mask
Mask number 
- BYTE Hi
The high byte (bits 8-15) of the ID 
- BYTE Lo
The low byte (bits 0-7) of the ID 
- VOID Return


SetRxMaskExd
Sets the 32-bit filter as a bit-mask of the extended ID for received messages The messages are accepted if (ExtID & Mask) == Filter  
- BYTE Mask
Mask 0 or 1 
- BYTE ID3
The high byte (bits 24-31) of the ID 
- BYTE ID2
The mid-high byte (bits 16-23) of the ID 
- BYTE ID1
The mid-low byte (bits 8-15) of the ID 
- BYTE ID0
The low byte (bits 0-7) of the ID 
- VOID Return


SetValue
Set the Value of the Named property 
- STRING Name
 
- STRING Value
 
- VOID Return


SetRxFilter
Generic function to set Identifier. CAN registers will be configured depending upon Std/Ext mode setting.  
- BYTE filter
 
- ULONG id
 
- VOID Return


SetTxIdent
Generic function to set Identifier. CAN registers will be configured depending upon Std/Ext mode setting.  
- BYTE buffer
 
- ULONG id
 
- VOID Return


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


InitRXConfig
Initialization setting for RX Buffer Config 
- BYTE Buffer
Buffer Number (0 or 1) 
- BYTE Value
Config data byte 
- VOID Return


Uninit
Uninitialises the CAN, freeing its connections for general use  
- VOID Return


GetList
Get the Filter List of the Named Property 
- STRING Name
 
- STRING Return


GetRxIdent
Generic function to get the received message Identifier.  
- BYTE buffer
 
- ULONG Return


SetRxFilterStd
Sets the 16-bit filter as a bit-mask of the standard ID for received messages The messages are accepted if (StdID & Mask) == Filter  
- BYTE Filter
Filter number 
- BYTE Hi
The high byte (bits 8-15) of the ID 
- BYTE Lo
The low byte (bits 0-7) of the ID 
- VOID Return


SetRxFilterExd
Sets the 32-bit filter as a bit-mask of the extended ID for received messages The messages are accepted if (ExtID & Mask) == Filter  
- BYTE Filter
Send filter: 0 to 3 
- BYTE ID3
The high byte (bits 24-31) of the ID 
- BYTE ID2
The mid-high byte (bits 16-23) of the ID 
- BYTE ID1
The mid-low byte (bits 8-15) of the ID 
- BYTE ID0
The low byte (bits 0-7) of the ID 
- VOID Return



Property reference

Properties
Channel
Selects the CAN channel to be used 
TX Pin
 
RX Pin
 
TX Remap
 
RX Remap
 
Bus Rate
selects the Bus Rate (KHz) 
Sample Point
selects the Sample Point for bit reading 
SJW
Synchronization Jump Width adjusts the bit clock by 1 to 4 TQ periods 
Fosc
 
BRGCON1
 
BRGCON2
 
BRGCON3
 
ID Type
selects the CAN ID type 
Message ID
CAN Message ID for Transmit Buffer 0 
Length
Number of valid data bytes in the message 
D0
Data byte 0 
D1
Data byte 1 
D2
Data byte 2 
D3
Data byte 3 
D4
Data byte 4 
D5
Data byte 5 
D6
Data byte 6 
D7
Data byte 7 
Message ID
CAN Message ID for Transmit Buffer 1 
Length
Number of valid data bytes in the message 
D0
Data byte 0 
D1
Data byte 1 
D2
Data byte 2 
D3
Data byte 3 
D4
Data byte 4 
D5
Data byte 5 
D6
Data byte 6 
D7
Data byte 7 
Message ID
CAN Message ID for Transmit Buffer 2 
Length
Number of valid data bytes in the message 
D0
Data byte 0 
D1
Data byte 1 
D2
Data byte 2 
D3
Data byte 3 
D4
Data byte 4 
D5
Data byte 5 
D6
Data byte 6 
D7
Data byte 7 
Settings
Filter setting for Receive Buffer 0 
Mask
Value for Receive Mask 0 
Filter 0
Value for Filter 0 
Filter 1
Value for Filter 1 
Settings
Filter setting for Receive Buffer 1 
Mask
Value for Receive Mask 1 
Filter 2
Value for Filter 2 
Filter 3
Value for Filter 3 
Filter 4
Value for Filter 4 
Filter 5
Value for Filter 5 
Connections
Simulations