怎么做判断后延时,延时后再判断?
‘循环扫描哪个通道的值为1
i = 0
Do Until zt8403dibit(m_cardNO, i + 1) = 1
i = i + 1
If i = m_chCount Then i = 0
Loop
iRecord = i
然后需要延时再做如上循环,并和上一个iRecord进行比较,判断iRecord的值是否有变化,如果有变化再延时,循环,再和上一个iRecord进行比较,判断iRecord的值是否有变化,直到iRecord的值相同为止。
[解决办法]
加标签,判断后使用goto语句
[解决办法]
我是楼主的同学,做的是中泰的8493采集卡,我帮她想了想,各位大虾帮我看看这样对不对。
Public Sub collect()
i = 0
Do Until zt8403dibit(m_cardNO, i + 1) = 1
i = i + 1
If i = m_chCount Then i = 0
Loop
End Sub
Private Sub doloop()
Call collect
iRecord = i
lp:
sleep 1000
Call collect
iAgain = i
If iAgain = iRecord Then
ledDI(iAgain).Value = 1
ledDO(iAgain).Value = 1
Else
iRecord = iAgain
GoTo lp
End If
End Sub
[解决办法]
修改楼上的
Private Sub doloop()
Call collect
iRecord = i
do while true
sleep 1000
Call collect
iAgain = i
If iAgain = iRecord Then
ledDI(iAgain).Value = 1
ledDO(iAgain).Value = 1
exit do
Else
iRecord = iAgain
End If
loop
End Sub