Documentation

Softing CAN-AC2-PCI with SJA1000 Send

Softing CAN-AC2-PCI with SJA1000 Send block

Library

Simulink® Real-Time™ Library for CAN

Description

The Send driver block transmits data to a CAN network from within a block model.

To use CAN_MESSAGE data types to transmit messages, first use the CAN Pack block to create CAN messages for transmission.

  • Do not mix message data types with each Send block. Either transmit only CAN_MESSAGE data types, or transmit only 8 bytes in double data types.

  • To prepare a remote frame, use the CAN Pack block with the Remote frame check box selected. To request the current value, send the remote frame to the responding subsystem.

Block Parameters

Board

Defines the board used to send out the CAN messages defined by this block instance. For more information about the meaning of the board number see the Setup driver block described above. If just one board is present in the target system, select board number 1.

CAN port

Selects the CAN port to which the CAN message is sent.

CAN identifier range

Selects the identifier range of the CAN messages sent by this block instance. If an application makes use of mixed standard and extended identifier ranges, you must use at least two instances of this block, each defining the corresponding identifier range.

If the CAN message data type is a CAN_MESSAGE data type, this range must match the range packed in the message parameter (for example, the message from the CAN Pack block).

Identifiers

Defines the identifiers of the CAN messages sent by this block. It must be a row vector in which the elements define a set of either standard or extended identifiers. Each element must be in the range between 0 and 2047 for standard identifiers or 0 and 229 − 1 for extended identifiers. The number of identifiers for each CAN port in a model per physical CAN board cannot exceed 200 (limitation of the firmware's dynamic object mode). The number of elements defined here also defines the number of input ports of the block. The block icon displays the selected identifier at each input port.

  • If the CAN message data type is CAN_MESSAGE, connect each input port to one CAN Pack block. Verify that the Identifier parameter for each CAN Pack block matches the send block input port. Do not connect a vector of messages to an input port. Each input port number also indicates sending priority, with the lowest number having the highest priority.

    If the CAN message data type is a CAN_MESSAGE data type, these identifiers must match those packed in the message parameter (for example, the message from the CAN Pack block).

  • If the CAN message data type is not CAN_MESSAGE data type, each input port accepts the data frame to be sent along with the CAN message. The signal entering each input port must be a scalar of type double representing the maximum size of 8 bytes of a CAN message data frame.

Data frame sizes

Defines the data frame size, in bytes, for each CAN message represented by an identifier in the Identifiers list. It must be a row vector in which the elements define a set of data frame sizes. Each element must be in the range between 1 and 8. If the data frame sizes for the identifiers must be the same, you can provide the size as a scalar, and scalar expansion applies. If the sizes are different for at least two identifiers, you must provide one element for each identifier. Therefore the length of the two vectors must be the same.

If the CAN message data type is a CAN_MESSAGE data type, these identifiers must match those packed in the message parameter (for example, the message from the CAN Pack block).

Show status output ports

Enables status output ports for each CAN message represented by an identifier in the Identifiers list. If the check box is selected, the block shows as many output ports as input ports. The data type of each output port is a double, given in the table. Refer to the Softing® manual for more information. The function return codes are:

CodeDescription

0

Function executed without detecting an error.

-1

Request overrun.

-2

CAN_MESSAGE data type only. Input port message from CAN Pack block has incorrect Identifiers or CAN identifier range value.

This is not a Softing standard.

-3

CAN_MESSAGE data type only. Input port message from CAN Pack block has incorrect Data frame sizes value.

This is not a Softing standard.

-4

Timed out firmware communication.

-99

Board not initialized.

Sample time

Defines the sample time at which the Send block is executed during a real-time application run.

You can use as many instances of the Send block in the model as required. For example, by using two instances of the block, you can send CAN messages at different sample times. Or you can use multiple instances to structure your model more efficiently.

Was this topic helpful?