How to change the fieldbus address (station no.) of a profibus box

Requirements

To change the the fieldbus address (station no.) of a profibus box in a configuration, an instance of the TwinCAT System Manager must be created, and the configuration has to be opened. The LookupTreeItem method of the ITcSysManager interface returns a ITcSmTreeItem interface pointer implemented by the tree item referenced by its pathname.

This interface contains a ConsumeXml method of the tree item.

Procedure

The ProgId "TCatSysManager.TcSysManager" can be used to create an instance of the System Manager that implements the ITcSysManager interface. This interface has a LookupTreeItem method that returns a ITcSmTreeItem pointer to a specific tree item given by its pathname. To change the the fieldbus address (station no.) of a profibus box "TIID^Device 1 (FC310x)^Box 1 (BK3100)" to 44 the following vbscript code can be used:

Sample (vbscript):

dim tsm
dim item
set tsm = CreateObject("TCatSysManager.TcSysManager")
call tsm.OpenConfiguration("c:\twincat\myConfig.wsm")
set item = tsm.LookupTreeItem("TIID^Device 1 (FC310x)^Box 1(BK3100)")
call item.ConsumeXml("<TreeItem><BoxDef><FieldbusAddress>44</FieldbusAddress></BoxDef></TreeItem>")

call tsm.SaveConfiguration

See Also

How to... section, ITcSysManager, LookupTreeItem, ITcSmTreeItem, ConsumeXml

Built on Tuesday, Mai 01, 2001