Blocks
Mask
Description
The OpCanAc2 Recv block receives CAN data frames for one Standard or Extended identifier. The block refers to a physical port that is configured in the OpCanAc2 Ctl block. Note: The Dynamic Object Buffer mode is not supported anymore and the FIFO mode is now always used.
Parameters
Controller ID | Refers to the OpCanAc2 Ctl block where the Can-Ac2 port configuration is provided. |
---|---|
Use External Identifier | This parameter will create additional inputs allowing the user to read dynamically message's IDs. The parameters Identifier, Output Line Width, Gain, and Offset shall be turned into inputs disappearing from the block's mask. |
Note: New inputs Gain and Offset shall be available only if the parameter Show engineering values is selected.
Identifier | Identifier of the data frame to be received. |
---|---|
Identifier Type | Specifies the length of the data frame identifier. Normal type is 11 bits long while extended is 29 bits long. |
Output Line Width | List that defines how the data from the data frame is supplied on the Data output pin. The list is handled from left to right and starts with byte 0 of the CAN data frame. For instance, a list of [4 4 8] means that the first (MSB) 4 bits of CAN data Byte 0 will be supplied on the Data output pin followed by the next 4 bits of Byte0 and the 8 bits forming Byte1. |
FIFO internal Buffer Size | Specifies the number of frames the block may store before producing values to Simulink. |
Max number of packets | Specifies the maximum number of frames that the block may produce to Simulink per calculation step. For instance, with a FIFO Internal Buffer Size of 10 and a Max number of packets of 3, up to 10 frames can be saved in the internal buffer but the block will only output from 0 to 3frames whenever it is called. Assuming 4 frames have been received, the block will output the first 3 frames and keep the remaining one for the next execution. |
Sample Time | Sample time of the block. A value of 0 represents the fastest sample time of the model. |
Show timestamps | Creates an additional outport which returns the timestamp of incoming data frames in seconds. |
Show DLC | Creates an additional outport which returns data length in bytes. |
Show engineering vales | Creates an additional out port which returns the RawData values with applied Gain and Offset according to the following equation: Eq. 1 Engineering value=RawData*Gain + Offset |
Gain | Vector the same length as Output line width specifying gain values to be applied. When using external ID input, the constant Gain vector should be zero-padded to keep the same length in the case we shall read a CAN message with shorter Output Line Width. |
Offset | Vector the same length as Output line width specifying offset values to be applied. When using external ID input, constant Offset vector should be zero-padded to keep the same length in the case we shall read a CAN message with shorter Output Line Width. |
Data unpacking | This option allows formatting data unpacking for compatibility with other devices. Two notions are implied. The first specifies if the unpacking of the signal should be started from the start or end of the data frame. If Signal 1 to N is selected, the packing will start from the less significant bits of the first transmitted byte. If Signal N to 1 is selected, unpacking will start from the most significant bits of the last transmitted byte and progress back into the data frame. The second specifies if groups of 8, 16 or 32 bits must be permuted within the data frame with respect to its middle boundary. Swapping is performed before extracting signals. |
Signal 1 to N | No swapping corresponds to the Intel format while Signal N to 1 - Swap 8-bit corresponds to the Motorola format. |
Inputs
The following inputs are available only if the parameter Use External Identifier is selected.
Identifier | See definition of parameter Identifier |
---|---|
Output Line Width | See the definition of parameter Output Line Width |
Gain Vector | See the definition of parameter Gain |
Offset Vector | See the definition of parameter Offset |
Outputs
Error: Reception Error value. The following table shows possible values and meaning:
Error values | |||||||
---|---|---|---|---|---|---|---|
0 | No Error | ||||||
-1 | Hardware FIFO overrun | ||||||
-3 | Software buffer overrun (Internal FIFO buffer size should be increased) | ||||||
-4 | Reception is halted due to the fact that block's Msg ID is not compatible with current Identifier Type. |
Status: Reception Status value. The following table shows possible values and meaning:
Status values | |||||||
---|---|---|---|---|---|---|---|
1 | A new data frame is available | ||||||
0 | No new data frame |
Nbr of Packet | Returns the number of new data frames that are available on the Data output pin(s). |
---|---|
RawData/Packet N | The vector containing the data values in the format specified in the Output Width List parameter. |
Timestamp | Optional outport which indicates the time stamp in seconds of received data frames. |
Eng. Values Pckt N | Optional outport which returns the engineering values corresponding to raw data. (Values resulting from applying gain and offset according to Eq. 1.) |
DLC | Optional outport which returns the length in bytes of the received data. |
Characteristics and Limitations
CanAc2 Host Simulation
CanAc2 blocks now support execution of user-specific code duringWin32 target simulation. For more information, please refer to the CanAc2 HostSimulation documentation.
Direct Feedthrough | No |
---|---|
Discrete sample time | Yes |
XHP support | Yes |
Work offline | No |