canReceiveMessage (Functionblock) |
Top Previous Next |
This receives a message from the CAN network. Before any reception is realised, a receive filter must have been created with canFilterCreate, canFilterCreateOnce, canFilterCreateX, or canFMSFilterCreate. If the canLoopBackMode is enabled, all transmitted messages from the RTCU will be received - but only if a receive filter is set up. The function block must also be initialized and manually updated in order to receive any messages. When a message has been received, the ready flag will be set, and the buffer defined during initialization contains the data while the function block output variables contain the message identifier (ID) information. The data is valid until the function block is updated again. The RTCU will buffer all valid incoming messages in an internal buffer with room for 100 messages - further messages will be lost. This will not, however, affect the logger which has its own buffer.
The function block can only receive CAN messages from the first CAN bus.
Input: data : PTR Address of the buffer to receive the data in. Note: the buffer must be 8 bytes long.
Output: xtd : BOOL
id : DINT The identifier of the message.
datasize : SINT Number of bytes received.
ready : BOOL True if a message has been received.
Declaration: FUNCTION_BLOCK canReceiveMessage;
Example: INCLUDE rtcu.inc |