CAN interface

Almost all CANopen masters from Beckhoff offer the so-called CAN interface. The CAN interface is a Layer-2 implementation of the CAN interface. It enables any desired CAN telegrams to be received and transmitted. The higher-level protocol is not important here, i.e. all CAN-based protocols can be used; however the protocol part must then be implemented in the PLC.

A detailed description of the CAN interface can be found at:
https://download.beckhoff.com/download/document/io/infrastructure-components/can-interface_en.pdf

Any CAN data can be sent via the CAN interface. There is a choice between 11-bit identifier (CAN 2.0A) or 29-bit identifier (CAN 2.0B).

Message structure with 29-bit support

Send data: In "NoOfTxMessages" enter the number of data you want to send from the Tx buffer. If the buffer has capacity for 10 entries, the maximum number of telegrams that can be send consecutively is 10. "Length" defines the number of PDO data bytes (maximum 8 bytes). Fill in the data and enter the identifier of the CAN message in "codId". Now increment the TxCounter value. 

Sample code: Sending messages from the PLC

if Outputs.TxCounter = Inputs.TxCounter then
     for i=0 to NumberOfMessagesToSend do
          Outputs.TxMessage[i] = MessageToSend[i];
     End_for
     Outputs.NoOfTxMessages = NumberOfMessagesToSend;
     Outputs.TxCounter := Outputs.TxCounter + 1;
end_if

Sample code: Receiving messages from the PLC

if Outputs.RxCounter <> Inputs.RxCounter then
     for i := 0 to (Inputs.NoOfRxMessages-1) do
          MessageReceived[i] := Inputs.RxMessage [i];
     End_for
     Outputs.RxCounter := Outputs.RxCounter+1;
end_if