Sample03: C++ as ADS server
This article describes:
- The creation of a TC3 C++ module that acts as an ADS server.
The server provides an ADS interface for starting / stopping / resetting a counter variable in the C++ module. The counter is available as a module output and can be assigned to an output terminal (analog or a number of digital IOs).
How the TC3 ADS server function written in C++ is to be implemented. - The creation of a C# ADS client to interact with the C++ ADS server.
The client provides a UI for connection locally or via a network to an ADS server with the ADS interface to be counted. The UI enables the starting / stopping / reading / overwriting and resetting of the counter.
Sample code: ADS Client UI written in C#.
Understanding the sample
Options for the automatic determination of an ADS port are used in the sample. The disadvantage of this is that the client has to be configured at each start in order to access the correct ADS port.
Alternatively, the ADS port can be hard-coded in the module as shown below.
Disadvantage here: The C++ module cannot be instanced more than once as it is not possible to share an ADS port.
Further Information