NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Multi-Threads , but seem not action.....

dear all
 
excuse me
 
sorry , this topic is fuzzy
 
I want to
create a FLAG(bool type)  and a EVENT(bool type) on TestStand4.0 , both default value is false  
 
 
Have three thread  , object is :
After 5 seconds , FLAG= true                                                                                                                                ...(thread1)
Call extra DLL(function1) that be builded by VisualC++6.0 , if FLAG==true , EVENT=true                                 ...(thread2)
Call extra DLL(function2) that be builded by VisualC++6.0 , if EVENT==true , write simply string into *.txt        ...(thread3)
 
Three threads's begin time is the same (I don't sure it , I setting "Use New Thread" on Execution Option menu)
 
 
But have some trouble ...
I don't know how to clear!
 
Bug seem is  FLAG/EVENT's status isn't dynamic , keep on initial status
 
I already set a NULL loop for listen FLAG/EVENT's status
but thread2 & 3 seem no into loop
 
 
as file is DLL's source code & sequence file
 
Please give me any suggestion ^^ thanks
0 Kudos
Message 1 of 5
(3,718 Views)
Hello stockton,
 
   您寫的程式會造成在執行DLL的程式時,進入無窮迴圈的狀態
   下面附檔是我幫您修改的DLL程式碼和新的Sequence file
   請您參考一下
 
   Alexander Chen,
   Applications Engineer, National Instruments Taiwan
0 Kudos
Message 2 of 5
(3,680 Views)
Hi Alexandre
 
謝謝你的幫忙 ^^
 
依你的source code來看
 
是否也代表著
 
Wait Loop(等待旗標改變的無限迴圈)  無法設置於DLL內??
 
我的想法是 把迴圈設定於DLL內 而不是TestStand上
 
 
請問 你這樣設定
 
是因為使用者喜好 還是"只能"這麼做(無法設置於DLL內)  ??
 
謝謝你的熱心回覆~
 
 
0 Kudos
Message 3 of 5
(3,659 Views)

剛執行了一下

依舊會無窮迴圈咧 @@

 

且我不是很懂 設置於TestStand上的LOOP

while(FileGlobals.flag == False)
    Call Extra DLL ;

所以程式一開始 就會一直不斷地呼叫DLL (FileGlobals.flag 預設為False)

並在function1內 一直將

*EVENT=false;

直到五秒過後 FileGlobals.flag 被更動為true

但這時候 就停止呼叫function1................ 那麼 *EVENT永遠不可能會變成true阿 !! @@

麻煩幫忙一下 THANKS

0 Kudos
Message 4 of 5
(3,658 Views)
Hello,
關於您的問題
(a) While loop
     若您將while loop設於DLL中,那麼就要等到裡面的while loop停止執行
     而您將FLAG傳進去當做停止的條件,但是DLL只有被呼叫ㄧ次
     所以FLAG也只會傳進去一次,這個動作跟TestStand無關
     您使用其他的程式語言也會有相同的問題
(b) 關於TestStand Sequence的執行,請您參考下面我修改的檔案
      目前我是可以正常的執行,執行後會有TXT檔案的出現
 
  Alexander Chen,
  Applications Engineer, National Instruments
0 Kudos
Message 5 of 5
(3,653 Views)