Softing CAN-AC2-PCI with SJA1000 Receive block
Simulink® Real-Time™ Library for CAN
The Receive driver block retrieves data from a CAN network to be used within a block model. You can use as many instances of the Receive block in the model as required.
To use CAN_MESSAGE data types to transmit messages, use the CAN Unpack block to unpack individual signals from the received CAN messages.
Do not mix message data types in a block. Each block can receive only CAN_MESSAGE data types, or receive only 8 bytes in double data types.
To process a remote frame, use the CAN Unpack block
with the Output remote check box selected to
enable the Remote port. When the Remote port becomes
send the current value to the requesting subsystem.
Defines the board the CAN messages defined by this block instance are retrieved from. 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.
Selects the CAN port from which the CAN messages are retrieved.
Selects the identifier range of the CAN messages retrieved 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 Identifier type parameter of the connected CAN Unpack block.
Defines the identifiers of the CAN messages retrieved 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 output ports of the block. The block icon displays the selected identifier at each output port.
Defines the message length, 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 message lengths. Each element must be in the range between 0 and 8. If the message length for the identifiers must be the same, you can provide the length as a scalar, and scalar expansion applies. If the lengths are different for at least two identifiers, you must provide one length element for each identifier. Therefore the dimensions of the two vectors must be the same.
If the CAN message data type is CAN_MESSAGE, connect each output port to one CAN Unpack block. Verify that the Identifier parameter for each CAN Unpack block matches the Receive block output port.
If the CAN message data type is not CAN_MESSAGE data type, each output port outputs the data frame being retrieved along with the CAN message. The signal leaving each output port is a scalar of type double representing the maximum size of 8 bytes of a CAN message data frame.
From the list, select:
Output vector of one double with just data.
Data - Status
Output vector of two doubles. First element of the vector contains the data, the second element contains the status.
Data - Timestamp
Output vector of two doubles. First element of the vector contains the data, the second element contains the timestamp.
Data - Status - Timestamp
Output vector of three doubles. First element of the vector contains the data, the second element contains the status, the third element contains the timestamp.
CAN_MESSAGE data type
One CAN_MESSAGE. You can extract the data, status, and timestamp from this message using a CAN Unpack block.
Refer to the Softing® manual for more information. The function return codes are:
No new data received.
Data frame received.
Remote frame received.
Receive data frame overrun.
Receive remote frame overrun.
Object not active.
Timed out firmware communication
Board not initialized.
Defines whether the CAN messages defined in this instance of the block will initiate an interrupt from the CAN board each time they are received. If selected, you can use CAN messages to control real-time application execution.
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 Receive block in the model as required. For example, by using two instances of the block, you can check for CAN messages at different sample times. Or you can use multiple instances to structure your model more efficiently.