beckhoff TE1000 TwinCAT 3 — 6.7.1 Creating and handling TcCOM modules

Samples | TcCOM 6.6.21 Scanning a CX/K-bus | Scanning a CX/K-bus CCAT devices connected to CX controllers via K-bus or EtherCAT can be scanned using the Automation Interface. For these devices, it is necessary to combine ReloadDevice and ScanBoxes into a single ConsumeXml request. This is the only way to ensure that the connected terminals are recognized correctly. Requirements A CX controller with a K-bus or CCAT interface is configured as a device. // Look up CCAT device (adjust path as needed) ITcSmTreeItem cxDevice = sysManager.LookupTreeItem(@"TIID^Device_3"); TwinCAT is in Config mode. // For CCAT devices:

ReloadDevice and ScanBoxes must be sent in a single ConsumeXml call string scanXml = @" true 1 "; cxDevice.ConsumeXml(scanXml); Setting true simultaneously is required for CCAT devices on the CX5000 and comparable CX controllers. Without this addition, ScanBoxes will not return a result for some CCAT configurations. After the scan, the terminals that are found are automatically added to the I/O configuration. 6.7 TcCOM | TcCOM 6.7.1 Creating and handling TcCOM modules | Creating and handling TcCOM modules This chapter describes how to add existing TcCOM modules to an existing TwinCAT configuration and how to configure them. This chapter briefly covers the following topics:

obtaining a reference to a “TcCOM Objects” node adding TcCOM modules iterating through added TcCOM modules setting the CreateSymbol flag for parameters setting the CreateSymbol flag for data areas setting the context (tasks) linking variables Obtaining a reference to a “TcCOM Objects” node In a TwinCAT configuration, the “TcCOM Objects” node is located under “SYSTEM^TcCOM Objects”. Therefore, you can retrieve a reference to this node by using the ITcSysManager::LookupTreeItem() method as follows: Code snippet (C#): ITcSmTreeItem tcComObjects = systemManager.LookupTreeItem("TIRC^TcCOM Objects"); Code snippet (PowerShell):

$tcComObjects = $systemManager.LookupTreeItem("TIRC^TcCOM Objects") Adding existing TcCOM modules The code above assumes that a SystemManager object already exists in your AI code. TE1000 273 Version: 1.7.0