ethercat-linux/scripts/tc-ads-state.ps1
Tony Cao aabfe31526 Enable EL6695 DC-Synchron mode (AssignActivate 0x320)
- DC selection must use the structured <Dc><Data AssignActivate/> XSD
  element; legacy DcData hex writes get normalized to zeros by TwinCAT
- TwinCAT converts it to DcData '2003...' (0x0320) on save: SYNC0/SYNC1
  cyclic + SYNC0 activate for the bridge
- Verified: clean activation, ticker OP, bSync=True, 90k cycles 0 errors,
  timing unchanged (jitter 7.3us mean)
- docs: pitfall #10 (DC selection method)
2026-08-09 15:32:56 +08:00

14 lines
500 B
PowerShell

$ErrorActionPreference = 'Continue'
Add-Type -Path 'C:\Program Files (x86)\Beckhoff\TwinCAT\3.1\Components\Base\v170\TwinCAT.Ads.dll'
foreach ($port in @(10000, 851)) {
try {
$c = New-Object TwinCAT.Ads.TcAdsClient
$c.Connect('169.254.176.217.1.1', $port)
$st = $c.ReadState()
Write-Host "port $port : AdsState=$($st.AdsState) DeviceState=$($st.DeviceState)"
$c.Dispose()
} catch {
Write-Host "port $port : ERR $($_.Exception.Message)"
}
}