Set the active topic configured in an alias topic
An active topic can be set programmatically by an OPC or a DDE client. The alias topic should be configured to Switch on Command. The following describes how each client can set the active topic.
DDE Client
These are two examples using Microsoft Excel VBA.
RSIChan = DDEInitiate("RSLinx", "System")
Application.DDEExecute RSIChan, "[Set_Alias(My_Alias,KT_Topic)]"
and
RSIChan = DDEInitiate("RSLinx", "System")
Application.DDEExecute RSIChan, "[Set_Alias(My_Alias)]"
where:
RSLinx
is the DDE application name.System
is a predefined topic of RSLinx Classic.My_Alias
is the user configured alias name in RSLinx Classic.KT_Topic
is the DDE topic that RSLinx Classic switches to.Set_Alias(AliasTopic)
attempts to swap to the next topic.also,
Set_Alias(AliasTopic,Topic2Swap2)
attempts to swap to Topic2Swap2.OPC Client
You can swap alias topics from OPC, using a predefined @SwitchTopic item that can also be told what topic to switch to. This is swapped at when the item is started, and is not reswapped until it is stopped and started again. We recommend you create the item inactive, and perform an Asynchronous Read on it. There are two methods for calling it:
- @SwitchTopic swaps to the next topic
- @SwitchTopic (topicToSwapTo) swaps to topicToSwapTo if it exists, or ignores it if it does not exist
Provide Feedback