Linking into TwinCAT 3
Creating new project
Start Microsoft Visual Studio and create new project (Windows Forms Application).
Adding reference
In order to select the TwinCAT.Ads class library you must choose the command Add Reference... under the Project menu . You will find the .Net Libraries per default in following TwinCAT folder:
C:\TwinCAT\AdsApi\.NET\
This opens the Add Reference dialog:
In this dialog you have to press the Browse button and select the file TwinCAT.Ads.dll for your used .NET Framework runtime.
In the Solution Explorer you can check, if the component has been added to the list of references:
All accessible types (classes,structures ...) belong to the namespace TwinCAT.Ads. Therefore one has to insert the following line at the beginning of the source :
using System.IO;
using TwinCAT.Ads;
This enables access to the types defined in TwinCAT.Ads without including the name of the namespace. The class TcAdsClient is the core of the TwinCAT.Ads class library and enables the user to communicate with an ads device. To begin with an instance of the class must be created. Then a connection to the ADS device is established by means of the Connect method.