| Contents | Index |
xPC Target Library for CAN
The Receive driver block retrieves data from a CAN network to be used within a block model.
Tip 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 true, send the current value to the requesting subsystem. |

Selects the CAN port from which to retrieve the CAN messages.
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.
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. 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.
Defines the type of retrieved data output at each output port. Three different types of data can be output, data frame, status, and timestamp.
The status information is of type double and is identical to the return value of function CANPC_read_rcv_data(...), described in the Softing user manual. Refer to the manual for more information. The function return codes are:
| Code | Description |
|---|---|
0 | No new data received. |
1 | Data frame received. |
2 | Remote frame received. |
-1 | Receive data frame overrun. |
-2 | Receive remote frame overrun. |
-3 | Object not active. |
-7 | Timeout firmware communication |
-99 | Board not initialized. |
The timestamp information is of type double and outputs the latest time at which a CAN message with the corresponding identifier was received. This time information in seconds (with a resolution of 1 microsecond) can be used to implement timeout logic within your model.
The pop-up menu lets you select the output information output at each output port of the block. If you select Data, each output port signal is a scalar only. If you select Data - Status, each output port signal is a vector with two elements in which the first element contains the data frame and the second element the status information. If you select Data - Status - Timestamp, each output port signal is a vector with three elements in which the first element contains the data frame, the second element the status information, and the third element the timestamp.
Defines whether the CAN messages defined in this instance of the block initiate an interrupt from the CAN board each time they are received. If selected, you can use CAN messages to control model (target application) execution.
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 Receive 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.

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 |