TcAdsClient.WriteAny Method (UInt32, UInt32, Object)

Writes an object synchronously to an ADS device.

Namespace:  TwinCAT.Ads
Assembly:  TwinCAT.Ads (in TwinCAT.Ads.dll) Version: 4.3.0.0

Syntax

C#

public void WriteAny(
    uint indexGroup,
    uint indexOffset,
    Object value
)

VB

Public Sub WriteAny ( 
    indexGroup As UInteger,
    indexOffset As UInteger,
    value As Object
)

Parameters

indexGroup

Type: System.UInt32
Contains the index group number of the requested ADS service.

indexOffset

Type: System.UInt32
Contains the index offset number of the requested ADS service.

value

Type: System.Object
Object to write to the ADS device.

Implements

IAdsAnyAccess.WriteAny(UInt32, UInt32, Object)

Examples

Usage of ReadAny/WriteAny

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

    client.Connect(AmsNetId.Local, 851);
    adsClient.WriteAny(0x4020, 0x0, valueToWrite);
    valueToRead = (uint)adsClient.ReadAny(0x4020, 0x0, typeof(UInt32));
}

Reference

TcAdsClient Class

WriteAny Overload

TwinCAT.Ads Namespace