CAN
Displays a list of the available commands.
CAN PRINTCONFIG
Displays details of the current configuration. The details displayed are module status (online or offline), speed and configured channels.
CAN CONFIG ok
ok (output) – 1 if successful, 0 otherwise
Clears any pre-existing configuration and puts the CAN module into configuration mode.
CAN SETSPEED speed, ok
speed (input) – baud rate in kbps from 10,000 to 1,000,000
ok (output) – 1 if successful, 0 otherwise
Sets the baud rate of the CAN connection. Value provided is bits per second with a minimum of 10kbps and a maximum of 1Mbps.
CAN ADDRXCHNL channel_num, can_id, msg_type, buffer_size, ok
channel_num (input) – a CAN channel from 0 to 31
can_id (input) – a CAN id to filter for (set to 0 to receive all CAN messages)
msg_type(input) – 0 for standard 11-bit IDs, 1 for extended 29-bit IDs
buffer_size(input) – size of the FIFO buffer for this channel expressed as number of records
ok (output) – 1 if successful, 0 otherwise
Configures the specified channel as a receive channel. To filter for an individual id provide the CAN id of interest, to receive all messages pass in a zero id. If you’re monitoring a single id (with this channel) and want to act on the latest data set the buffer size to 1. Larger buffer sizes can be set to capture more data – note that no indication is given when buffer overrun occurs (the oldest data is simply discarded).
CAN ADDTXCHNL channel_num, buffer_size, ok
channel_num (input) – a CAN channel from 0 to 31
buffer_size(input) – size of the FIFO buffer for this channel expressed as number of records
ok (output) – 1 if successful, 0 otherwise
Configures the specified channel as a transmit channel. Normally a buffer size of 1 is sufficient. However, larger sizes allow you to separate the construction and buffering of transmissions from the actual transmission.
CAN ENABLE ok
ok (output) – 1 if successful, 0 otherwise
Description: Once the configuration is complete call this command to put the CAN module into normal operating mode and ready to receive or transmit data.
CAN RX channel_num, can_id, msg_type, length, data(8), ok
channel_num (input) – a CAN channel from 0 to 31 for a channel previously configured for RX
data(8) (output) – an array to receive the data from the FIFO record
ok (output) – 1 if successful, 0 if no data available or other failure occurs
This command is intended to read the data only from a channel that has been previously configured to monitor for a given ID (hence the id is already known and doesn’t need to be retrieved from the buffer).
Note: The description of the RX and TX commands specify the required size of the data array. However, when calling these functions you will pass in a reference to the first item of the array. Assuming you are using zero-based arrays and an array called data then when you call the function this will be data(0). See the examples for clarification
CAN RX channel_num, data(8), ok
channel_num (input) – a CAN channel from 0 to 31 for a channel previously configured for RX
can_id (output) – the CAN id of the message read from the FIFO buffer
msg_type (output) – the message type of the message read from the FIFO buffer
length (output) – the amount of data read (between 0 and 8 bytes)
data(8) (output) – an array to receive the data from the FIFO record
ok (output) – 1 if successful, 0 if no data available or other failure occurs
Description: This command is intended to read information from the FIFO buffer of a channel that has been previously configured to receive all messages – hence the need to provide variables to retrieve the full information about the message.
Note: The description of the RX and TX commands specify the required size of the data array. However, when calling these functions you will pass in a reference to the first item of the array. Assuming you are using zero-based arrays and an array called data then when you call the function this will be data(0). See the examples for clarification
CAN TX channel_num, can_id, msg_type, length, data(8), ok
channel_num (input) – a CAN channel from 0 to 31 for a channel previously configured for RX
can_id (input) – the CAN id to send
msg_type (input) – the message type being sent (0=SID, 1=EID)
length (input) – the amount of data being sent (between 0 and 8 bytes)
data(8) (input) – an array of data bytes to send (values between 0 and 255)
ok (output) – 1 if successful, 0 otherwise
Places data into the FIFO buffer for this channel. Data will be sent on the bus when the CAN module detects the bus is available (i.e. not busy).
Note: The description of the RX and TX commands specify the required size of the data array. However, when calling these functions you will pass in a reference to the first item of the array. Assuming you are using zero-based arrays and an array called data then when you call the function this will be data(0). See the examples for clarification
CAN DISABLE ok
ok (output) – 1 if successful, 0 otherwise
Description: Puts the module into offline mode, but does not destroy the configuration. This can be used to stop all processing of CAN messages while another processor intensive task takes
place. CAN ENABLE can then be called to re-enable the pre-existing configuration.
CAN FREE
Takes the module off line and frees all memory associated with the existing configuration.
Applies to:
CGCOLORMAX with installed ‘795 processor
Leave a Reply