Raptor:CAN Rx Raw

From NewEagleWiki
Jump to navigation Jump to search

Return to the main Raptor page

Return to CAN page

Raptor CAN Rx Raw

Description

This block is used to receive a CAN message when access to the raw receive bytes is necessary. The Raptor™ CAN Rx Message block can be used if the raw receive bytes are not needed.

This block can receive messages on multiple IDs through the message ID filter ID and mask. For each bit in the mask parameter which contains a 1, the corresponding bit of the incoming message ID must match the corresponding bit in the ID parameter. Some modules do not support a fully open mask (all 0s).

Each CAN rx block uses its own queue to buffer the incoming messages until the block can execute. If another message is received once the queue is full then the oldest message is overwritten. To always get the data from the last message set the queue size to 1.

The mailbox is a mechanism to link a CAN rx block with a CAN trigger block. This allows code to be executed whenever a message is received. The mailbox name must be unique for each receive block (if used), but can have multiple trigger blocks using the same mailbox name.

One Simulink Function can be triggered directly from this block, as if a CAN Trigger block had been used. A mailbox name must be defined in order to use this. The Simulink function should be placed somewhere along the calling block's path to model root.

Outputs

Output Type Description
Age uint32 The number of times this block has executed since a new message was received. Age is 0 when a new message is being output.
extended boolean Indicates if the received message's ID was standard (0) or extended(1).
ID uint32 Indicates the ID of the received message.
length uint8 The number of data bytes in the received message.
Data uint8[8] The data in the received CAN message. If the length is less than 8, this block will still output a vector of 8 bytes, but the upper bytes may have unspecified contents.

Parameters

Parameter Type Description
CAN Bus Name String The CAN bus to transmit the message on.
Extended ID Indicates if this block will receive standard or extended ID messages.
ID Number The ID used in the receive message filter.
Mask Number The mask used in the receive message filter.
Mailbox String Identifies the mailbox trigger that is connected to this receive block.
Queue Size Number Specifies the size of the receive queue.
Use Simulink Function checkbox Whether to use a Simulink Function callback with this block's mailbox.

The Mailbox field needs to be filled to use this callback. This works the same as using a CAN Trigger block with a priority of 0.

CAN Rx Raw Simulink Function Name String Name of the Simulink Function to call when this block is triggered.
Create button Create a Simulink Function to use with the CAN RX Raw block. Must first provide a valid function name.
Update button Update the listed Simulink Function's signature to 0 inputs & 0 outputs. The Simulink Function listed in the box must already exist.