| Description | The CAN_request function sends a REMOTE FRAME request (a special CAN message that requests transmission of a specific msg) via the CAN controller hardware specified by ctrl. If the CAN controller hardware is ready (no other transmissions are in progress), the CAN_request function sends the REMOTE FRAME request immediately. If the CAN controller is busy, the request msg is put into a FIFO (that is managed using an RTX mailbox). Messages stored in the the FIFO are sent in order. The timeout specifies how long to wait for the FIFO (mailbox slot) to become available. | timeout | Description |
|---|
| 0 | Return immediately. | | 0x0001-0xFFFE | Wait the specified number of RTX Kernel ticks. | | 0xFFFF | Wait infinitely. |
If a request is not stored in the FIFO by the specified time, an error is returned. The CAN_request function executes quickly since all data transfers use software buffers. Only in situations where the FIFO is full is the CAN_request function delayed. The CAN_request function is part of RL-CAN. The prototype is defined in RTX_CAN.h. |
| Example |
#include <rtx_can.h>
__task void task_send_CAN (void) {
CAN_msg msg_buf = {
33, // ID
{ 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 }, // Data
1, // Length
1, // Channel
STANDARD_FORMAT, // Format
REMOTE_FRAME // Type
};
while (1) {
// Request DATA FRAME message ID 33
// on CAN Controller 1
CAN_request (1, &msg_buf, 0x0F00);
// Wait 100ms
os_dly_wait (10);
}
}
|