tc_fieldbus
Configure NON-EtherCAT fieldbus devices (PROFINET, PROFIBUS, CANopen, DeviceNet, EAP) offline in TwinCAT. Supports master/slave/box creation, resource claiming, GSD box import, and batch operations.
Instructions
Create + configure NON-EtherCAT fieldbus masters/slaves/boxes (PROFINET / PROFIBUS / CANopen / DeviceNet / EAP net-vars) via ITcSmTreeItem CreateChild + ClaimResources + ConsumeXml. OFFLINE CONFIG ONLY — no confirm token needed; runtime needs a later activate/restart; TISC (safety) paths refused. For EtherCAT terminals/boxes use tc_ethercat instead. BATCH-FIRST: for more than one device use create_batch (N ops in ONE DTE attach, continue-on-error roll-up {count,succeeded,failed,results:[{parent,name,ok,child?,claimed?,error?}]}). SubType cheat-sheet — PROFINET ctrl 113/119/126/140, dev 115/118/142/143; PROFIBUS master 86 slave 97; CANopen master 87 slave 98; DeviceNet master 41/73/88 slave 62/74/99 monitor 59 box 5203; EAP device 112 publisher 9051 subscriber 9052. Actions: create_device (parent? default TIID / EAP device path, name, subType, before?, vInfo?, claimIndex?, save?) — CreateChild a master/slave/box; claimIndex immediately ClaimResources to bind underlying hardware; a wrong subType/vInfo ghost is cleaned up and reported as failure; create_batch (creates:[{parent?,name,subType,before?,vInfo?,claimIndex?}], save?); list_resources (path) — read-only; probes ITcSmTreeItem5.ResourcesCount then ResourceCount (Beckhoff pages disagree on the name) and reports which answered; claim_resources (path, index [1-based per Beckhoff examples], save?) — bind the node to underlying FC/EL hardware (offline config edit, NOT a runtime write); create_gsd_box (controllerPath, name, gsdPath, moduleIdentNumber, subType [REQUIRED — PN device subType, depends on controller variant], boxFlags? [GENERATE_NAME_FROM_PAB 0x0004 / GET_STATIONNAME 0x0400 / SET_NOT_IP_TO_OS 0x4000], dapNumber?, before?, save?) — PROFINET GSD/GSDML box; vInfo = gsdPath#moduleIdentNumber#boxFlags#dapNumber. CAVEAT: GSD box subType + vInfo format from a doc summary, confirm against infosys 1041677067 before relying on it; add_netvar (boxPath = EAP publisher/subscriber box, name, dataType [IEC type as vInfo, e.g. BOOL/INT], before?, save?) — EAP pub/sub variable (SubType 0; resulting ItemType 35 publisher / 36 subscriber); set_station_address (path = PROFIBUS slave/box, address, save?) — discovers the address element via ProduceXml then ConsumeXml a minimal envelope (the bare-number form is unverified and NOT shipped); if discovery fails, use get_xml + set_xml; import_dbc (masterPath = CANopen master, fileName [.dbc], importExtendedMessages?, importMultiplexedDataMessages?, keepUnchangedMessages?, communicateWithSlavesFromDbcFile?, save?) — CanOpenMaster/ImportDbcFile config import (requires TC3.1 build >= 4018); get_xml (path) — raw ProduceXml passthrough for discovering real param elements; set_xml (path, xml = partial XML, returnXml?, save?) — generic ConsumeXml escape hatch for any fieldbus param not covered above.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| xml | No | ||
| mode | No | DTE attach mode; default active | |
| name | No | ||
| path | No | ||
| save | No | ||
| index | No | ||
| vInfo | No | ||
| action | Yes | ||
| before | No | insert before this sibling | |
| parent | No | ||
| address | No | ||
| boxPath | No | ||
| creates | No | ||
| gsdPath | No | ||
| subType | No | ||
| boxFlags | No | ||
| dataType | No | ||
| fileName | No | ||
| dapNumber | No | ||
| returnXml | No | ||
| claimIndex | No | ||
| masterPath | No | ||
| controllerPath | No | ||
| moduleIdentNumber | No | ||
| keepUnchangedMessages | No | ||
| importExtendedMessages | No | ||
| importMultiplexedDataMessages | No | ||
| communicateWithSlavesFromDbcFile | No |