CanRecv – Receive CAN message

Block SymbolLicensing group: CANDRV
PIC

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 NodeMode = 256).

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

data

Message data (8 bytes maximum, LSB first)   -9,22337E+18  9,22337E+18

large

length

Message length (number of bytes of data)   0  8

long

nDRDY

Number of received messages in the last period   255

word

iErr

Error code

error

age

Elapsed time since the last received message [s]   0.0

double

Parameters

filterId

MessageId of packets to receive by this block   0  536870911

long

filterIdMask

Mask for the filterId parameter (marks valid bits)   0  536870911

long

filterLength

Data length of packets to receive by this block (-1 allows all lengths)   -1  8

long

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

nmax

Maximum number of received messages in one period   1  255

long

2019 © REX Controls s.r.o., www.rexygen.com