CAN Transmit

Purpose

Transmits CAN messages.

Description

../../_images/can_tx.svg

The CAN Transmit block sends out data on a CAN bus. The data to send must be provided on the block input d as a vectorized signal with data type uint8. The length of the transmitted CAN message is determined by the width of the input signal (1 to 8 bytes).

Messages are either sent regularly with a fixed sample time or on demand when the trigger input changes. When configured for triggered execution, messages are sent when the trigger signal changes in the manner specified by the Trigger type parameter:

rising

Data is sent when the trigger signal changes from 0 to a non-zero value.

falling

Data is sent when the trigger signal changes from a non-zero value to 0.

either

Data is sent when the trigger signal changes from 0 to a non-zero value or vice versa.

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 that is used for CAN messages sent by this block. The CAN ID can be supplied as either an 11 bit value (for CAN 2.0A compliance) or 29 bit value (for CAN 2.0B compliance).

Execution

Selects between regular and triggered execution.

Sample time

The time period for regular packet transmission (for regular execution only).

Trigger type

The direction of the edges of the trigger signal upon which the data is sent, as described above (for triggered execution only).

Offline simulation

Enables or disables data inspection 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 sent to the CAN Transmit block is available at 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.