beckhoff TE1000 TwinCAT 3 — 6.6.3 Creating and handling network variables

Samples | I/O 0.0.0.0 0.0.0.0 1 0 false 0 0 1000 false false The following table shows how the nodes marked in bold must be adapted according to the desired communication pattern. The “Activated” attribute must be set to “true” on the node. Creating Subscriber variables After you have successfully added a Publisher Box, you can now add Publisher variables to this box by using the ITcSmTreeItem::CreateChild() method together with the required parameters for SubType (0) and vInfo, which define the data type of the Publisher variables, e.g. "BOOL". Code snippet (C#):

ITcSmTreeItem subBox = systemManager.LookupTreeItem("TIID^Device 1 (EtherCAT Automation Protocol)^Box 1 (Subscriber)"); subVar = subBox.CreateChild("MAIN.bTestVar", 0, null, "BOOL"); Code snippet (PowerShell): $subBox = $systemManager.LookupTreeItem("TIID^Device 1 (EtherCAT Automation Protocol)^Box 1 (Subscriber)") $subVar = $pubBox.CreateChild("MAIN.bTestVar", 0, $null, "BOOL") See also the scripting container example "EtherCAT Automation Protocol" for more information. Linking Publisher/Subscriber variables To link Publisher/Subscriber variables with PLC variables, simply use the ITcSysManager::Linkvariables() method. Code snippet (C#):

systemManager.LinkVariables("TIPC^PLC Project^PLC Project Instance^PlcTask Outputs^MAIN.bTestVar", "TIID^Device 1 (EtherCAT Automation Protocol)^Box 1 (Publisher)^MAIN.bTestVar^Outputs^VarData"); Code snippet (PowerShell): $systemManager.LinkVariales("TIPC^PLC Project^PLC Project Instance^PlcTask Outputs^MAIN.bTestVar", "TIID^Device 1 (EtherCAT Automation Protocol)^Box 1 (Publisher)^MAIN.bTestVar^Outputs^VarData") TE1000 253 Version: 1.7.0 RT Ethernet communication pat- tern Broadcast 255.255.255.255 0.0.0.0 Multicast Must contain a multicast IP address. Contains a default gateway, if applicable, to which the packages for routing must be sent.

Otherwise leave at 0.0.0.0 Unicast Must contain a (unicast) IP address. Contains a default gateway, if applicable, to which the packages for routing must be sent. Otherwise leave at 0.0.0.0