CAN Message Read

This MotoHawk™ block will receive and unpack a CAN message on the selected CAN channel.

Block ID

Read CAN Message

Library

MotoHawk_lib/CAN Blocks

Description

 

Attach Simulink signal specifications the output ports, to convert the output signals to an appropriate data type. Specifically, if a gain or offset is applied in the message specification, assign the signal to the floating-point data type. This block is capable to reading CAN as well as CAN FD frames should the hardware support it (see motohawk_can_fd_example.m). More information about configuring a CAN read definition script as well as using a payload mask and payload ID to route messages with same CAN message ID to different CAN read blocks, and configuring a CAN mask ID filter to receive multiple CAN frames on the same CAN read block can be found here.

Note: Unpacking signals which consists of signed or unsigned integers greater than 32-bits long is not supported.

Block Parameters

Parameter Field Values Comments/Description
Reference Name Alpha-numeric text, single-quote enclosed. Reference to CAN Definition channel to read, matching "Name" entry in CAN Definition block. No special characters, such as spaces, dashes, commas (underscore allowed)
Message Definition Identify message definition file.  See motohawk_can_example.m for single frame use, and motohawk_can_multiread_example.m for using payload filtering of received messages. Details on defining CAN definition scripts can be found here.
Queue Size Numeric Sets the size of the incoming message queue that will hold messages until this block executes. A value of zero or one will make only the most recently received message available.
Slot Name Alpha-numeric text, single-quote enclosed. May be empty.  It allows other blocks to reference the slot, such as the CAN Receive Slot Properties Set block which can be used to dynamically set by ID, ID Mask, Payload, and Payload Mask. It is also referenced by the CAN Receive Slot Trigger block.
No special characters, such as spaces, dashes, commas (underscore allowed).
Show Data Available Port Check Box (enable) If selected, a port will be added that will have the value 1 if a message is available and zero otherwise. If the queue size is larger than 1, one can associate a Simulink Do-While block to this port and poll all of the messages out of the Queue.
Show Age Count Port Check Box (enable) This port increments every time the block executes and no messages are available. The date from this port can be used to do timeout logic on a message.
Label Wires with Field Names Check Box (enable) Select this checkbox to cause the field names to be applied to the wires leading into the block.