CAN - Send message

Symbol (normal)

Symbol (RTR activated)

This function block allows to send CAN messages with a static configuration of the data types. This configuration enables an automatic assembly of data bytes in the CAN frame as well as the calculation of data length.

The parameter dialog allows different settings, so the function block summarizes 16 transmission functions.

Parameters

The following settings can be made over the parameter dialog:

- CAN controller:

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

- CAN ID:

  • length:
    • 11bit (standard)

… 0 <= CANID <= 2047 (0x7FF)

    • 29bit

… 0 <= CANID <= 536870911 (0x1FFFFFFF)

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

- RTR:

  • Not used (standard) … sending the frame is triggered by the „SendDat“ input
  • Activated … The frame is automatically requested by a received RTR frame and sent immediately and asynchronously to the program task.

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

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

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

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

Signals (normal)

Name I/O Type(s) Function
COBId I WORD/LONG CAN-ID (11/29Bit)
SendDat   BIT Activate sending
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)
Data1-8 O UCHAR, WORD, LONG, FLOAT Data
DataReq O BIT Info: Sent data