CanRecv – Receive CAN message
Block SymbolLicensing group: CANDRV
Function Description
The CanRecv block receives message via CAN bus. The message is defined by the msgId, data and length inputs and the RTR and EXT parameters.
Number of messages received in the current task period (i.e. since the previous execution) is indicated by the nDRDY output.
The data from the last received message is available at the msgId, data and length outputs. Previous messages (with respect to the nmax parameter) are available using the CanItem block(s) linked to the itemRef output.
The block must be linked with the CanDrv driver. The driver must be configured to use the simple CAN mode (i.e. the parameter ).
The block’s name must be in the form <DRV>__<blkname> (see e.g. OUTQUAD or OUTOCT blocks for details about referencing data from I/O drivers). The <blkname> part of the name has no special meaning in this case and it is recommended to keep the original CanRecv.
The block supports short (11-bit) and long (29-bit) message IDs (see the EXT parameter) and RequestToReceive messages (see the RTR parameter). FD mode which allows up to 64 data bytes in a single message is not supported.
Outputs
itemRef | Secondary received packet reference | Reference |
msgId | CAN message ID (COB-ID) | Long (I32) |
data | Message data (8 bytes maximum, LSB first) -9.22337E+18 9.22337E+18 | Large (I64) |
length | Message length (number of bytes of data) 0 8 | Long (I32) |
nDRDY | Number of received messages in the last period 255 | Word (U16) |
iErr | Error code | Error |
age | Elapsed time since the last received message [s] 0.0 | Double (F64) |
Parameters
filterId | MessageId of packets to receive by this block 0 536870911 | Long (I32) |
filterIdMask | Mask for the filterId parameter (marks valid bits) 0 536870911 | Long (I32) |
filterLength | Data length of packets to receive by this block (-1 allows all lengths) -1 8 | Long (I32) |
RTR | Request To Receive flag on | Bool |
EXT | Extended message ID (29bits) on | Bool |
timeout | Error is indicated if no packet is received within the timeout interval [s] 0.0 | Double (F64) |
nmax | Maximum number of received messages in one period 1 255 | Long (I32) |
[Previous] [Back to top] [Up] [Next]
2023 © REX Controls s.r.o., www.rexygen.com