How to link variables
Requirements
To link variables in a configuration, an instance of the TwinCAT System Manager must be created, and the two variables must be referenced by their pathnames
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 LinkVariables method. To link the two variables "TIPC^Project 1^Standard^Outputs^MyOutput" and "TIID^Device 1 (C220)^Box 1^Term 1^Channel 1^Output" the following vbscript code can be used:
Sample (vbscript):
dim tsm
set tsm = CreateObject("TCatSysManager.TcSysManager")
call tsm.OpenConfiguration("c:\twincat\myConfig.wsm")
call tsm.LinkVariables("TIPC^Project1^Standard^Outputs^MyOutput", "TIID^Device 1 (C220)^Box1^Term 1^Channel 1^Output")
call tsm.SaveConfiguration
If the two variables have different sizes, the LinkVariables method has three further optional parameters to specify which bits and bytes are to be linked together.
See Also
How to... section, ITcSysManager, ITcSysManager::LinkVariables
Built on Tuesday, Mai 01, 2001