ethercat-linux/scripts/tc-open-project-800b.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

19 lines
936 B
PowerShell

#Requires -RunAsAdministrator
$ErrorActionPreference = 'Continue'
# Open project in visible XAE and leave it running for interactive inspection.
$dte = New-Object -ComObject TcXaeShell.DTE.17.0
$dte.MainWindow.Visible = $true
try { $dte.SuppressUI = $false } catch {}
$dte.Solution.Open('C:\Users\tonycao\work\twincat3-auto-cli\TwinCAT_EL6695_Primary_800B\TwinCATProject1.sln')
Start-Sleep 25
$sm = $null
for ($i = 0; $i -lt 20; $i++) {
try { $sm = $dte.Solution.Projects.Item(1).Object; if ($sm) { break } } catch {}
Start-Sleep 3
}
if (-not $sm) { Write-Host 'no sysmgr'; exit 1 }
try { $sm.SetTargetNetId('169.254.176.217.1.1'); Write-Host 'target set' } catch { Write-Host "target: $_" }
Start-Sleep 3
try { Write-Host "IsTwinCATStarted=$($sm.IsTwinCATStarted)" } catch {}
Write-Host 'XAE left open. Inspect: TIID -> 设备 1 (EtherCAT) -> 模块 3 (EK1100) -> 模块 10 (EL6695) -> IO Inputs / IO Outputs -> Online tab'