beckhoff TE1000 TwinCAT 3 — 6.6.4 Creating and handling AX5000 devices

Samples | I/O See also the scripting container example "EtherCAT Automation Protocol" for more information. Reading Publisher/Subscriber variable IDs The following code snippet reads all variable IDs from a Publisher Box and saves them in the list array "ids". This can also be used for Subscriber variables. Code snippet (C#):

List ids = new List (); ITcSmTreeItem pubBox = systemManager.LookupTreeItem("TIID^Device 1 (EtherCAT Automation Protocol)^Box 1 (Publisher)"); foreach(ITcSmTreeItem var in pubBox) { if (var.ItemType == 35) // 35 = publisher variable, 36 = subscriber variable { string varStr = var.ProduceXml(); XmlDocument varXml = new XmlDocument(); varXml.LoadXml(varStr); XmlNode id = varXml.SelectSingleNode("//TreeItem/NvPubVarDef/NvId"); ids.Add(Convert.ToUInt32(id.InnerXml)); } } Code snippet (PowerShell):

$ids = New-Object System.Collections.ArrayList $pubBox = $systemManager.LookupTreeItem("TIID^Device 1 (EtherCAT Automation Protocol)^Box 1 (Publisher)") foreach($var in $pubBox) { if($var.ItemType -eq 35) { $varXml = [Xml]$var.ProduceXml() $id = $varXml.TreeItem.NvPubVarDef.NvId $ids.Add($id) } } 6.6.4 Creating and handling AX5000 devices | Creating and handling AX5000 devices This documentation article describes how to create AX5000 devices and and modify their mailbox startup list as well as their power management, PDO and motor condfiguration. All of these settings can be modifies by using the XML description [ } 27] of the AX5000 TreeItem. This article consists of the following chapters:

Creating an AX5000 I/O device Overview XML description Parametrization and template generation Available tools and samples Mappings Creating an AX5000 I/O device AX5000 devices can be created by using the CreateChild() method. Please consult the documentation article Creating and handling EtherCAT devices for more information. Code snippet (C#) ITcSmTreeItem etherCatMaster = sysManager.LookupTreeItem("TIID^EtherCAT Master"); ITcSmTreeItem ax5000 = ethercatMaster.CreateChild("AX5000", 9099, "", "AX5203"); Code snippet (Powershell) $etherCatMaster = $sysManager.LookupTreeItem("TIID^EtherCAT Master") $ax5000 = $ethercatMaster.CreateChild("AX5000", 9099, "", "AX5203") TE1000 254 Version: 1.7.0