Receiving data from I/O-Task

As mentioned bfore, the OPC-Server gives the possibility to read/write process values from ADS devices and therefore also from the TwinCAT I/O.

The following steps need to be taken to make an I/O task available via OPC:

Step 1: Configuration of I/O-Task

To make an I/O Task available via OPC, please open the TwinCAT Solution and navigate to "SYSTEM" - "Tasks" - "TaskName".

Receiving data from I/O-Task 1:

Activate the checkbox "Create Symbols" .

Step 2: Configuration of the OPC-Server (one-time step)

In the second step you need to configure the OPC-Server. This is a one-time configuration.

Start TwinCAT-OPC-Configurator "Start \ All Programs\ Beckhoff \ TwinCat3 Functions \ TF6120 OPC-DA"

Receiving data from I/O-Task 2:

In the left navigation tree please select "I/O Devices" with a right click the menu item "New".

Receiving data from I/O-Task 3:

Enter a name for that ADS device in field "Name". The name has to be OPC conform. Special characters are not allowed. The device-name will be part of the ItemID later. Sample: TwinCAT-PLC was defined with a variable "Temp". Choosing the devicename as "IO1" the opc-server present the variable as "IO1.Temp". With click on "OK" we get the new dialog for further settings of device :

Receiving data from I/O-Task 4:

The following table gives an overview about all possible settings:

Parameter

Beschreibung

Name

Name of Name device, e.g. IO1. This will be the name under which the device will be accessible for the OPC-Client.

Description [optional]

Optional description for the device.

AutoCfg

5 : Get symbolic via ADS

AutoCfgSymFile

Not needed in this case.

AdsPort

ADS port number of device, e.g. 351 for I/O Task

AdsNetId [optional]

Address of the ADS device. By default this is 0.0.0.0.0.0 for local system.

AdsTimeout [optional]

Timeout for ADS connection to the device, measured in [ms]. If the device is not reachable within that timeframe, the OPC-Server returns BAD_QUALITY to the OPC-Client.

AdsTimeSuspend [optional]

Suspend time for the ADS device, measured in [ms]. If the ADS connection breaks, the OPC-Server waits this time before sending the next ADS request to the runtime.

Disable [optional]

Deactivates the device.

Save the configuration via "File" --> "Save As". After the configuration has been saved, you will be asked if this configuration should be set as the startup-configuration.

Receiving data from I/O-Task 5:

The configuration will be automatically activated on next restart of the OPC-Server.

Receiving data from I/O-Task 6:

Receiving data from I/O-Task 7:

Apply settings

If you have activated a configuration and the OPC-Server does not seem to apply the settings, please make sure that the OPC-Server has been stopped and started once.