上位机使用的是ifix组态软件,用concept2.5的984逻辑梯形图 使用以下的语句实现了: Function Trimk(cc0) Dim i, j, s1 j = Len(cc0) i = 1 While i < j + 1 s1 = Mid(cc0, i, 1) \'MsgBox \"s1=\" & s1 & \";\" If s1 = \" \" Or s1 = \" \" Then cc0 = Mid(cc0, 1, i - 1) + Mid(cc0, i + 1, j) i = i - 1 \'MsgBox \"cc0=\" & cc0 End If i = i + 1 Wend Trimk = cc0 End Function
Function Delay(name As String) As Boolean name = Trimk(name) x = MsgBox(\"是否确认\", vbOKCancel, \"确认\")
If x = 1 Then writevalue \"1\", name
\'start = Timer \' Do
\' DoEvents \' Loop While Timer = start + 2 Else writevalue \"0\", name
End If
End Function
点击“启动”按钮下位的信号接通,然后点击“停止”按钮,梯形图上也显示信号中断了,但是再次点击“启动”就启动不了了,原因是,状态为置为“1”了,我怎么样用脚本实现“复位”这个功能,使状态回到0呢 |