Access Data via Symbolic path

The Read/Write Access by symbol path solves the issue of directly accessing the process image. With specifying the access path to the symbol, the symbol address can be found by a binary search (internally) and reading / writing symbols is independent of the location within the process image.

This access method can only be used, when the ADS device is supporting symbolic information like the TwinCAT PLC.

Because its indirect access, the performance is slightly worse than the direct access via IndexGroup/IndexOffset. However there are internal optimizations to cache handles to the already used symbols to accelerate repeated access.

Example

Access symbolic data by instance/symbol path

using (TcAdsClient client = new TcAdsClient())
{
    UInt32 valueToRead = 0;
    UInt32 valueToWrite = 42;

    client.Connect(AmsNetId.Local, 851);
    adsClient.WriteSymbol("MAIN.nCounter", valueToWrite, false);
    valueToRead = (uint)adsClient.ReadSymbol("MAIN.nCounter", typeof(UInt32),false);
}