Notes on the documentation

This description is only intended for the use of trained specialists in control and automation engineering who are familiar with the applicable national standards.
It is essential that the following notes and explanations are followed when installing and commissioning these components.

The responsible staff must ensure that the application or use of the products described satisfy all the requirements for safety, including all the relevant laws, regulations, guidelines and standards.

Disclaimer

The documentation has been prepared with care. The products described are, however, constantly under development.
For that reason the documentation is not in every case checked for consistency with performance data, standards or other characteristics.
In the event that it contains technical or editorial errors, we retain the right to make alterations at any time and without warning.
No claims for the modification of products that have already been supplied may be made on the basis of the data, diagrams and descriptions in this documentation.

Trademarks

Beckhoff®, TwinCAT®, EtherCAT®, Safety over EtherCAT®, TwinSAFE® and XFC® are registered trademarks of and licensed by Beckhoff Automation GmbH.
Other designations used in this publication may be trademarks whose use by third parties for their own purposes could violate the rights of the owners.

Patent Pending

The TwinCAT Technology is covered, including but not limited to the following patent applications and patents:
EP0851348, US6167425 with corresponding applications or registrations in various other countries.

Copyright

© Beckhoff Automation GmbH & Co. KG, Germany.
The reproduction, distribution and utilization of this document as well as the communication of its contents to others without express authorization are prohibited.
Offenders will be held liable for the payment of damages. All rights reserved in the event of the grant of a patent, utility model or design.


Overview

ADS over Real-time Ethernet enables real-time capable communication via Ethernet with UDP.

System requirements

  • W2K, XP, Windows Embedded standard;
  • TwinCAT installation level: TwinCAT PLC or higher;
  • TwinCAT system version 2.10.0 build >= 1328;

Installation

A prerequisite for real-time Ethernet is that all communication devices have the TwinCAT Ethernet protocol driver installed.

Further documentation:

  • Introduction in TwinCAT real-time Ethernet
  • Network variables (publisher/subscriber)


Configuration

Real-time Ethernet

Configuration:

Configuration example for ADS server/client communication.

Server:
In the TwinCAT System Manager select the local target system for the server. Right-click on "I/O devices" under "I/O configuration" to insert a new device. In the window that opens you can select "Real-Time Ethernet" device under Ethernet.

Before confirm your selection with OK, you can allocate a new name to the device at the bottom of the window. After confirmation select the appropriate network card, as shown in the next image.

Activate the "Enable Routing" checkbox in the "Routes" tab of new device. The NetID of the added RT Ethernet device is automatically entered in the associated field.

In the next step you can enter the NetID of a client under Route, and under "Add" you can add the NetID to other NetIDs with which the server can then communicate.

Client:

The same settings apply to the clients as for the server, except that the NetID of the server must be specified under "Routes" in the real-time Ethernet device.


Example

Real-time Ethernet

Example:

Based on the configuration described above you can now carry out a test with the following PLC project. In this example the server fetches an handle via ADS for a client variable and writes the value 500 to it. A useful application is shown in conjunction with ADS.

Server:

PROGRAM Server
VAR
    state        : UINT;
    trigger      : R_TRIG;
    bExecute     : BOOL;
    bBusy        : BOOL;
    bError       : BOOL;
    uErrorID     : UDINT;

    fbWRI        : ADSWRITE;
    fbRW         : ADSRDWRT;

    uTransmit    : UDINT := 500;
    uHandle      : UDINT;
    sTest        : STRING := 'MAIN.uReceive';
END_VAR

trigger(CLK := bExecute);
IF trigger.Q THEN
    state    := 1;
    bBusy := TRUE;
END_IF

CASE state OF

    0: (* Wait state *)
    bBusy := FALSE;

    1:
    fbRW(    WRTRD            := FALSE);
    fbRW(    NETID            := '172.16.2.94.2.1',
                   PORT          := 801,
                   IDXGRP        := 16#F003,
                   IDXOFFS       := 16#0000,
                   WRITELEN      := LEN(sTest)+1,
                   READLEN       := SIZEOF(uHandle),
                   SRCADDR       := ADR(sTest),
                   DESTADDR      := ADR(uHandle),
                   WRTRD         := TRUE,
                   TMOUT         := t#5s,
                   BUSY           => ,
                   ERR            => bError,
                   ERRID          => uErrorID);
state := 2;

2:
fbRW(     WRTRD    := FALSE);
IF NOT fbRW.BUSY THEN
    IF NOT fbRW.ERR THEN
        state := 3;
    ELSE
        state := 100;
    END_IF
END_IF

3:
fbWRI(    WRITE    := FALSE);
fbWRI(    NETID            := '172.16.2.94.2.1',
                PORT           := 801,
                IDXGRP         := 16#F005,
                IDXOFFS        := uHandle,
                LEN            := SIZEOF(uTransmit),
                SRCADDR        := ADR(uTransmit),
                WRITE          := TRUE,
                TMOUT          := t#5s,
                BUSY            => ,
                ERR             => bError,
                ERRID           => uErrorID);
state := 4;

4:
fbWRI(WRITE := FALSE);
IF NOT fbWRI.BUSY AND NOT fbWRI.ERR THEN
    state := 0;
ELSIF fbWRI.ERR THEN
    state := 100;
END_IF

100:
    ; (* Error *)
END_CASE

Client:

PROGRAM Client
VAR
    uReceive : UDINT;
END_VAR

Note:
- On the client side creation of a UDINT variable is sufficient.
- To use the source code for a test you have to adapt the NetIDs to your system.