CAN Receive

Purpose

Receives CAN messages.

Description

../../_images/can_rx.svg

The block initiates the reception of CAN messages with the given ID on the given CAN interface. On reception of a CAN message the data is made available on the block output d as a vectorized signal consisting of 8 bytes. The output v is 1 in each simulation step where new data is received, 0 otherwise.

The data at block output d always has a width of 8 bytes regardless of the length of the received CAN message.

Parameters

CAN interface

The CAN interface to use. The selected CAN interface must be configured in the RT Box Coder Options Dialog (see section CAN).

CAN ID source

Selects whether the CAN ID is specified as a parameter or is supplied as an input signal.

CAN ID

The CAN identifier for which this block receives CAN messages. The CAN ID can be supplied as either a 11 bit value (vor CAN 2.0A) or 29 bit value (for CAN 2.0B).

Frame format

Specifies the frame format that is used when filtering for matching CAN messages. Possible values are:

  • Base for CAN 2.0A messages with an 11 bit identifier

  • Extended for CAN 2.0B messages with an 29 bit identifier

  • Auto uses the Base format if the specified CAN ID is smaller than 2047. Otherwise, the Extended format is used.

Offline simulation

Enables or disables data injection in an offline simulation. If set to enabled, terminals are added to the subsystem for which code is generated. In an offline simulation the data which is to be received by the CAN Receive block can be injected into these terminals. The block must be placed in the root schematic of the subsystem for which code is generated. If set to disabled, no such terminals will be added and the block can be used at any subsystem level.