| Contents | Index |
xPC Target Library for CAN
The Send driver block transmits data to a CAN network from within a block model. You can define up to 200 send objects for standard and extended identifiers for each CAN channel.
To use CAN_MESSAGE data types to transmit messages, first use the CAN Pack block to create CAN messages for transmission.
Note
|

Defines the board to use to send 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.
Selects the CAN port to send the CAN message.
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).
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
-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 define
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.
Defines the data frame size for each identifier (CAN message) in bytes. 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 0 and 8. If the data frame sizes for all identifiers defined in the preceding control must be the same, you can provide the size as a scalar only and scalar expansion applies. If the sizes are different for at least two identifiers (CAN messages), one size element must be provided for each identifier specified in the Identifiers control. Therefore the lengths 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).
Enables status output ports for each identifier (CAN message). 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:
| Code | Description |
|---|---|
0 | Function executed without detecting an error. |
-3 | CAN_MESSAGE data type only. Input port message from CAN Pack block has incorrect Data frame sizes value. |
-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 | Timeout firmware communication. |
-99 | Board not initialized. |
Defines the sample time at which the Send block is executed during a model (target 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 define different sample times at which CAN messages are sent out. Or you can use multiple instances to structure your model more efficiently.

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |