Configuring the DeviceNet system
DeviceNet® devices are created under the I/O node via CreateChild. DeviceNet® boxes can be created under a DeviceNet® master; these boxes, in turn, contain process image variables on their input and output nodes. The SubType determines the device. Variables are created with their data type as vInfo parameters.
Requirements
- A TwinCAT solution is open, and a DTE connection is active.
ITcSysManagerwas initialized as a COM object in an STA thread.- The EL6752 is available as a master, and the EL6752-0010 is available as a slave.
C# sample
The DeviceNet® configuration has a hierarchical set-up. The master is created under the I/O node TIID, the box under the master, and the process variables under the box’s Inputs and Outputs nodes. When using CreateChild for a variable, the data type is passed as the fourth parameter, vInfo.
ITcSmTreeItem devices = sysManager.LookupTreeItem("TIID");
// Create DeviceNet master (SubType 88 = EL6752)
ITcSmTreeItem dnMaster = devices.CreateChild("Device 4 (EL6752)", 88);
// Create DeviceNet box under master (SubType 5203)
ITcSmTreeItem dnBox = dnMaster.CreateChild("Box 11 (EL6752-0010)", 5203, "", "");
// Add variables to the box process image
ITcSmTreeItem inputVars = sysManager.LookupTreeItem(
@"TIID^Device 4 (EL6752)^Box 11 (EL6752-0010)^Inputs");
inputVars.CreateChild("TestVar1", 0, null, "BIT");
inputVars.CreateChild("TestVar2", 0, null, "BOOL");
PowerShell sample
$devices = $sysManager.LookupTreeItem("TIID")
# Create DeviceNet master (SubType 88 = EL6752)
$dnMaster = $devices.CreateChild("Device 4 (EL6752)", 88, $null, $null)
# Create DeviceNet box under master (SubType 5203)
$dnBox = $dnMaster.CreateChild("Box 11 (EL6752-0010)", 5203, "", "")
# Add variables to the box process image
$inputVars = $sysManager.LookupTreeItem("TIID^Device 4 (EL6752)^Box 11 (EL6752-0010)^Inputs")
$inputVars.CreateChild("TestVar1", 0, $null, "BIT")
$inputVars.CreateChild("TestVar2", 0, $null, "BOOL")
SubType overview
|
Device |
SubType |
|---|---|
|
DeviceNet master EL6752 EtherCAT |
88 |
|
DeviceNet slave EL6752-0010 EtherCAT |
99 |
|
DeviceNet master FC52xx PCI |
41 |
|
DeviceNet slave FC52xx PCI |
62 |
|
DeviceNet master CX1500-M520 PC104 |
73 |
|
DeviceNet slave CX1500-B520 PC104 |
74 |
|
DeviceNet® monitor FC52xx PCI™ |
59 |
![]() | The data type of a variable is passed as the fourth parameter |
