Sub DDEreadStation1() On Error GoTo MessageRSLinxDead:
'make sure the DDE Channel is Closed before we define a Topic channel txtStat1Force.LinkMode = 0 txtStat1Status.LinkMode = 0
'set the Application and Topic of the Control Property 'DDETOPIC is a Public Constant in MainSubs Module 'I might use a configuration file later and let the user set this txtStat1Force.LinkTopic = "RSLinx|" & DDETOPIC txtStat1Status.LinkTopic = "RSLinx|" & DDETOPIC
'set the Address of the PLC we want to read txtStat1Force.LinkItem = "N7:1" txtStat1Status.LinkItem = "B3:1/1"
'set the DDE mode to COLD Link, we will request the data manually txtStat1Force.LinkMode = 2 txtStat1Status.LinkMode = 2
'tell VB to get the data from the PLC NOW! txtStat1Force.LinkRequest txtStat1Status.LinkRequest txtStat1TimeStamp.Text = Now()
MessageRSLinxDead: MsgBox ("RSLINX is not running. Can not continue!") SkipMessage:
When was the last time you drove down the highway without seeing a commercial truck hauling goods?The ubiquity of these machines underscores the important roll they play in modern commerce. Download Now