CAN - Receive message

Symbol (normal)

Symbol (RTR activated)

This function block allows to receive CAN messages with a static configuration of data types. This configuration enables an automatic break down of data bytes in a CAN frame as well as the calculation and check of the correct data length.

The parameter dialog allows different settings, which makes the function block combine 16 receive functions.

The receipt of the frames takes place asynchronously to the program task. Generally, the data from the last received message is output.

Basically the output “NewData” is set to “HIGH” when receiving a frame. When the function block is being processed, the internal memory is set back, so a “LOW” can be sent for the next program cycle, if no new message has been received.

Parameters

Over the parameter dialog, the following settings can be made

- CAN-Controller:

  • 1 (standard) – 4…the highest number depends on the target system and is assigned by the current template.

- CAN-ID:

  • Length:
    • 11Bit (Standard)

… 0 <= CAN-ID <= 2047 (0x7FF)

    • 29Bit

… 0 <= CAN-ID <= 536870911 (0x1FFFFFFF)

  • Type of assignment:
    • Dynamic over function block input
    • Fixed over dialog (standard) (no input)
  • Node number:
    • Not used (standard)
    • Added automatically

- RTR:

  • Not used (standard) … normal receipt
  • Activated … the additional input “RegData” is available. Over that input an RTR frame can be sent. After a “HIGH” edge on “RegData”, the receipt for the RTR reply is enabled.

- Description text for the message (optional and only for documentation)

- Data types of data inputs “Data1”-“Data8” (UCHAR, WORD, LONG, FLOAT)

- Description text for each data input (only for documentation)

Error during ID assignment (decimal/hexadecimal) and during configuration of message length are possible and are communicated accordingly. The length of a CAN frame has a maximum of 8 Bytes.

 

Several function blocks can “react” to the same ID. Data is received multiple times when having the same data length.

Signals (normal)

Name I/O Type(s) Function
COBId I WORD/LONG CAN-ID (11/29Bit)
NewData O BIT Info: receive data
Data1-8 O UCHAR, WORD, LONG, FLOAT Data

Signals (RTR activated)

Name I/O Type(s) Function
COBId I WORD/LONG CAN-ID (11/29Bit)
DataReq I BIT send RTR
NewData O BIT Info: receive data
Data1-8 O UCHAR, WORD, LONG, FLOAT Data