CAN_recv block

Short summary

Name

CAN_recv

→POU type

→function

Category

system blocks from "logi.library", Blocks for CAN, block with internal error diagnostic

Graphical interface

images/download/thumbnails/414779898/CAN_recv-version-1-modificationdate-1534488756592-api-v2.png

Available since

  • version 1.85.0 (for logi.CAD 3) and version 3.4.0 of logi.RTS – initial variant

  • version 1.111.0 (for logi.CAD 3) and version 3.19.0 of logi.RTS – enhancement:
    new inputs HANDLE and DATA, changed name for output CANID (instead of name ID), no output DATA any longer, additional return codes for output RC

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/warning.svg This block is supported for →phyBOARD-Regor, →phyBOARD-Wega and →µMIC.200.

Functionality

The block receives CANopen or CAN 2.0 messages.

Inputs, outputs


Identifier

→Data type

Description

Inputs:

HANDLE

DINT

handle of the CAN interface (with initial value -1)

DATA

REF_TO ARRAY[0..7] of BYTE

→reference to the transmission data

Outputs:

CANID

UDINT

CAN 2.0 or CANopen message ID

DLC

USINT

number of the received data bytes in the CAN message (= data length code)

RC

CAN_RETURN_CODE

return code of the block call as specified in data type CAN_RETURN_CODE with the following values:
CAN_OK, CAN_RECEIVE_ERROR, CAN_NO_RECEIVE_DATA_REFERENCE, CAN_SYSTEM_SERVICE_NOT_LOADED, CAN_NO_VALID_HANDLE, CAN_NO_CONNECTION, CAN_INTERFACE_SLOT_UNUSED


Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

Internal error diagnostic for block

The block checks the following error cases and – if they occur – the block sets the output ENO of the block value FALSE (or an equivalent): The return code of the block has not been 0 (see the above table under RC).

Example for usage within ST-editor

Best practice in order to get to know the usage of the CAN blocks: Create a new project based on the project template Simple logi.CAD 3 CANopen Project for PHYTEC phyBOARD-Regor and study this sample project. This project contains a usage of this block.