rxCANBusData

Top  Next

rxCANBusData


receive CAN Bus Data frame

Since R2019b

 

Library: CAN Bus Controller ( Dafulai Electronics) /rxCANBusData

 

 

rxCANBusData

 

 


 

Description


 

This block receives single CAN Data frame, and long Data frames. This is non-block function. It will return immediately no matter whether it receives your interesting CAN ID.

 

For single Data frame, DLC is decided by Data Input vector.

For long Data frames, frame Qty is decided by Data Input vector.

 

If "long Frames" is received, you must make sure all long frames are ready in receiver buffers.

How to make sure?  you must use "catchCANID" block to catch "the last frame of long data frames". And one solution is Simulink model's truly sampling time (Not simulated time) must be  bigger than entire long frames' received time.

Please use "wait" block to implement truly sampling time.  The other solution is that disable auto-refresh in "CAN Bus setup" block. When caught "the last frame of long data frames" by "catchCANID" block, call the "wait" block to delay "Long frames's broadcast cycle time" (Real time, not simulated time).

 

Parameters


 

Please double click this block to open parameters dialog below:

 

rxCANBusData_parameter1

 

 

Let us explain parameters.

 

 

Object ID for multiple CAN Bus controllers — In one PC, we may use multiple CAN bus controllers, this is for identifying each one we use. It must match the same parameter in CAN_setup block.

 

Received CAN ID — received CAN bus data frame's CAN ID. It is scalar.

 

Extended — true means "Received CAN ID" is 29 bits of extended. Otherwise, it is 11 bits of standard.

 

Remote Request Frame — true means "Transmit RTR frame". Otherwise, it means "Transmit Data frame".

 

Data Type — CAN bus data field's Data type. For single data frame, It is vector.  The element of this vector is string.  The valid string is "uint8", "uint16", "uint32", "uint64", "int8", "int16", "int32", "int64", "single", "double". It denotes "each data element's Data type in CAN bus frame's data field" although all elements' data type in output port "Data" vector is "double" (transfer to "double" for user easily to read).  For long data frames, it is scalar string because all data type is the same for long frames.

 

Endian for multiple bytes data type — Big-Endian or Little-Endian for "uint16"/"uint32"/"uint64"/"int16"/"int32"/"int64"/"single"/"double"

 

Long Frames — true means we will receive long frame data. It has the same data type for long frame data.

 

Output Data item Qty — Long frames' all truly data items Qty in your setting Data type.

 

The 1st frame Number — The 1st byte in data field for any long frame is frame number. For the 1st frame, the frame number can begin in number 0 or number 1.

 

 

 

Ports


 

Input

 

None

 

Outport


 

Data — "double" data type's vector. It is all received Data which are from received CAN bus raw data with your setting Data Type in input parameter. If  we didn't receive any data in this sample time, the output port Data will keep previous Data Value.

 

Rx — "logical" scalar. True means we received data in this sample time.

 

Examples