WaitMem方法

描述
等待記憶體位元狀態改變。

語法
Sub WaitMem (BitNumber As Integer, Condition As Boolean, Timeout As Single)
Sub WaitMem (Label As String, Condition As Boolean, Timeout As Single)

參數

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

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

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

另請參閱
WaitSw方法, SetPoint方法

WaitMem範例
VB 例:

' 等待記憶體位元1變成1 (True)  
' 最長時間為5秒  
m_spel.WaitMem(1, True, 5)  
' Did WaitMem time out?  
If m_spel.TW() Then  
    MsgBox "memory bit time out occurred"  
End If  

C# 例:

// 等待記憶體位元1變成1 (True)  
// 最長時間為5秒  
m_spel.WaitMem(1, True, 5);  
// WaitMem是否超時?  
if (m_spel.TW())  
    MessageBox.Show("memory bit time out occurred");