Specifications
Constructing and Extracting CAN Data Frames
4-45
The dialog box contains two controls (edit fields).
The first lets you define the bit patterns in a flexible way. The data type
entered in the control has to be a MATLAB cell array vector. The number of
elements in the cell array define the number of output ports shown by this
block instance. The cell array elements have to be of type double array and
define where the bits of the incoming double value (data frame) come to lie at
what position in the output port values (data typed).
From a data type perspective (output ports) the block behave like a Simulink
source block and therefore the data types of the output ports have to be defined
in the second control (edit field). The data type entered in that control has to be
a MATLAB cell array vector of the same length as the bit pattern cell array.
The cell array elements have to be of type char and define the data type of the
corresponding output port. The following values are supported:
boolean, int8, uint8, int16, uint16, int32, and uint32
The sample time of the block is inherited from the driving block. Therefore no
explicit sample time has to be provided in the block’s dialog box.
The functionality of the block is easiest explained by means of an example. We
take the same example as used above to demonstrate the functionality of the
bit-packing block. But in this case, the data frame is sent by an external CAN
node and is received by the target application running on an xPC Target
system. Therefore the bit-unpacking block has to be used in order to extract the
various data fields out of the entire data frame. Because the bit pattern