WaitSw方法

描述
等待輸入位元狀態改變。

語法
Sub WaitSw (BitNumber As Integer, Condition As Boolean, Timeoutl As Single)
Sub WaitSw (Label As String, Condition As Boolean, Timeoutl As Single)

參數

  • BitNumber
    代表輸入位元編號的整數運算式。
  • Label
    代表輸入位元標籤的字串。
  • Condition
    代表輸入位元狀態的Boolean運算式。
  • Timeout
    代表最長等待時間的單一運算式(以秒為單位)。

備註
請務必使用TW方法檢查是否發生超時。請參閱以下範例。

如果發生錯誤,且SpelException的ErrorNumber屬性為3101,請參閱SetPoint方法中的描述。

另請參閱
WaitMem方法, SetPoint方法

WaitSw範例
VB 例:

Const PartPresent = 1  
m_spel.WaitSw(PartPresent, True, 5)  
If m_spel.TW() Then  
    MsgBox "Part present time out occurred"  
End If  

C# 例:

const int PartPresent = 1;  
m_spel.WaitSw(PartPresent, True, 5);  
if (m_spel.TW())  
    MessageBox.Show("Part Present time out occurred");