Embedded Target for Motorola MPC555    
Vector CAN Receive

Read CAN messages from a Vector CAN channel

Library

Can Drivers (Vector)

Description

The Vector CAN Receive block reads CAN messages from the channel specified by the Configuration tag parameter. The block has the following outputs:

For an example of the use of the Vector CAN Receive and Transmit blocks, see the mpc555rt_io and mpc555rt_iohost demos.

Message Queuing

The Vector Can driver allocates a message queue to each Vector CAN Receive block. A message queue has a maximum size of 1024 messages. As messages are received from the CAN network, they are put into the appropriate queue.

When the Vector CAN Receive block executes, it polls the queue to see how long it is. If Loop to clear message queue is selected, then the block will read all messages from the queue and process them sequentially. If more messages arrive during this process, they are added to the end of the queue and processed the next time the Vector CAN Receive block executes. We recommend that you select the Loop to clear message queue option, to avoid overflowing the block's message queue.

If Loop to clear message queue is not selected, the Vector CAN Receive block processes only a single message from the queue is processed when the Vector CAN Receive block executes. Any other messages remain in the queue until handled by subsequent executions of the Vector CAN Receive block.

No messages are lost and no errors are reported until the queue size for a particular Vector CAN Receive block exceeds maximum length of 1024 messages.

Dialog Box

Configuration tag
A unique identifier for naming a configured CAN channel. This tag is used to associate the Vector CAN Receive block with a Vector CAN Configuration block. The Vector CAN Receive block will then receive messages from the channel specified in the Vector CAN Configuration block. You can assign more than one Vector CAN Receive block to the same CAN Configuration block.
CAN message identifier
Specify a single CAN message identifier for the message you want to receive.
CAN message type
Specify the CAN message type: either Standard (11 bit identifier) or Extended (29 bit identifier).
Sample time
Specifies how often the block is to poll the CAN driver to see if any messages are available on the specified channel.
Output timestamp
When this option is selected, a third port, labeled Timestamp, is added to the Vector CAN Receive block.
The message timestamp output gives the time that the message was received. This timestamp is the clock time at which the message was received, not the Simulink run time. The timestamp is an integer scaled to 10 microsecond resolution. A value of 1 on the timestamp output equals 10 microseconds.
Loop to clear message queue
(On by default.) Controls how the block handles cases where multiple messages are queued up between executions of the block. When Loop to clear message queue is selected, all messages in the queue for the block at the time of execution are processed. Any connected Function Call subsystem executes as many times as required.
When Loop to clear message queue is not selected, a single message from the queue for the block is processed, leaving any other messages on the queue to be processed in the future.

  Vector CAN Configuration Vector CAN Transmit