beautypg.com

BECKHOFF CP-Link3 User Manual

Page 68

background image

Page 68

cycle time for data exchange ).

4. Access via ADS to task or PLC variables linked locally on the client

In this case, the CPx8xx Bus Coupler is used on 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 case the Bus Coupler I/O
channels are mapped to I/O Task variables. These variables can be read by ADS from the host PC (also see Introduction
to ADS ).

4.a ADS access via 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. According to the input and output channels of the Bus Coupler, task variables have to be
added and linked with the input and output variables of the Bus Coupler.

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(