$ErrorActionPreference = 'Continue' Add-Type -Path 'C:\Program Files (x86)\Beckhoff\TwinCAT\3.1\Components\Base\v170\TwinCAT.Ads.dll' $c = New-Object TwinCAT.Ads.TcAdsClient $c.Connect('169.254.176.217.1.1', 851) $h = $c.CreateVariableHandle('GVL_Sync.nCycles') $n1 = $c.ReadAny($h, [uint64]) Start-Sleep -Milliseconds 5000 $n2 = $c.ReadAny($h, [uint64]) $c.DeleteVariableHandle($h) Write-Host ("nCycles rate = {0} Hz" -f [math]::Round(($n2 - $n1) / 5.0, 1)) $bs = $c.ReadAny($c.CreateVariableHandle('GVL_Sync.bSync'), [bool]) Write-Host "bSync = $bs" $c.Dispose()