以程式撰寫方式檢查VI是否在執行

更新 May 21, 2024

環境

軟體

  • LabVIEW

其他

軟體
  • LabVIEW 基本版
  • LabVIEW 完整版
  • LabVIEW 專業版

  • 如何以程式撰寫方式檢查VI是否在LabVIEW中執行?
  • VI有什麼不同的執行狀態?

您可以使用VI屬性節點(Property Node)來檢查VI的執行狀態。要判斷狀態,請按照以下方式檢查VI的Execution State :
  1. 從Applications Control Palette中選擇Open VI Reference
  2. 滑鼠右鍵點擊Open VI Reference的VI Path輸入,然後選擇Create»ControlCreate»Constant
  3. 從Applications Control Palette中選擇Property Node。將Open VI Reference的VI Reference輸出連接到Property Node上的Reference輸入。  在Property Node上,滑鼠左鍵點擊Property並選擇Execution»State 
  4. 滑鼠右鍵點擊Property Node的Execution State輸出,然後選擇Create»Indicator 。
  5. 從Applications Control Palette中選擇Close Reference VI。
  6. block diagram連接方式類似下圖:

以下是Execution:State屬性可能的值:
  • Bad:VI有錯誤無法執行或VI目前沒有執行。
  • Idle:VI沒有執行,但是在記憶體中。
  • Run top level:VI在執行結構中屬於上層VI。
  • Running:VI由一個或多個執行中的VI所保留。

Additional Information

如果VI Path不是有效路徑,則VI將回傳錯誤。