cp-link3

Access via ADS to task or PLC variables linked to the local client

In this case, the CPx8xx Bus Coupler is linked into the client as a local USB device. The CP Link 3 USB device server on the client is configured accordingly via a "Use Local List" (also see Using USB devices locally on the client). Access from host PC to the I/O channels of the Bus Coupler is implemented by the use of ADS. In this the Bus Coupler I/O channels are mapped to I/O Task variables. These variables can be read by ADS from the host PC.

Access via ADS and standard Ethernet

In a simple PLC example the ADS access to the client task variables should be shown here. A task is added to the client system configuration for this. Accordingly, the input and output channels of the Bus Coupler have task variables added and linked with the input and output variables of the Bus Coupler.

 cpx8xx_sysman_ads_client

The "ADS Info" of the client task variables are then used for ADS communication in the host PC PLC program.

A host PC PLC program for accessing the Bus Coupler outputs could look like this:

PROGRAM MAIN

VAR

fbAdsWrite : ADSWRITE;
netId : STRING := '5.3.112.17.1.1';
port : WORD := 301;
idxGrp : UDINT := 16#F030;
idxOffs : UDINT := 16#0;
data : WORD := 2#1010101010101010;
dataLen :UDINT := 2;
state :BYTE := 0;

END_VAR


CASE state OF

0:
   fbAdsWrite(
    NETID := netId,
    PORT := port,
    IDXGRP := idxGrp,
    IDXOFFS := idxOffs,
    SRCADDR := ADR(data),
    LEN := dataLen,
    WRITE := TRUE,
    TMOUT := T#1s
    );

   IF fbAdsWrite.ERR THEN
    state := 2;
   ELSE
    state := 1;
   END_IF

1:
   fbAdsWrite(WRITE := FALSE);
   IF fbAdsWrite.ERR THEN
    state := 2;
   ELSE
    IF NOT fbAdsWrite.BUSY THEN
      state := 2;
    END_IF
   END_IF

2:
   fbAdsWrite(WRITE := FALSE);
   state := 0;

END_CASE

Access via ADS and RT Ethernet

When an RT Ethernet connection is used for the ADS communication, the data is exchanged in deterministic cycle times, and this allows the I/O channels of the CPx8xx to be read and written deterministically. The recommended cycle time for data exchange with the terminals at the Bus Coupler is still 50 to 80 milliseconds (see also Cycle time for data exchange).

Setting up RT Ethernet:

A network adapter of both the host PC and the client must be configured as an RT Ethernet device and added to the I/O configuration (also see Configuration of RT Ethernet Devices).
"Routing" must be switched on for this RT Ethernet device on both on the host PC as well as on the client. In addition the NetIds of each of the RT Ethernet devices must be entered respectively in the Routing Tables (also see Configuration of RT Ethernet Devices).

Further configuration is carried out as described in 4.a with the exception that in the PLC program the NetId for the client RT Ethernet devices is entered as the NetId for ADS communication (this differs from the normal NetId).