CAN receive

Block to receive CAN messages

Description

A 'CAN Receive' block instructs the code generator to include CAN support. Each time the block is evaluated, the last message with the given CAN ID is used to get the output values. The 'new data' output gives a 1 or higher (true) if new data was received since the last evaluation, otherwise a 0 (false).

Remarks

Declaration

Use the CAN config block:

Input

The input port specifies the CAN ID of the message in hexadecimal format. The CAN ID must be applied in a UINT32 signal.
Set the 32nd bit to 1 in the CAN ID to configure it as a 29-bit Extended CAN identifier. For example 0x80000200 for CAN ID 0x200 as 29-bit identifier.

Output
Parameters
CAN channel
Select the used channel.
Output ports
Select the amount of ports you want from the given output type.
You can use only up to 8 bytes.
Output type
Select the data type each output port will use.
Byte ordering
Set the appropriate byte ordering for your CAN message:
Checkbox checked = Most Significant Bit (MSB) is received first (Motorola format).
Checkbox unchecked = Least Significant Bit (LSB) is received first (Intel format).
Sample time
Sample time of the block. The Sample time (in seconds) defines the rate at which the block is visited by the real-time scheduler of the target. The value of the Sample time has to be an integer multiple of the base sample time of the model.