08-04-2011 01:39 PM
Hi!
I have created simplest TS OI in Labview.
It has only two buttons: "Start test once" and "Stop execution".
The OI based only on TS API without TS controls.
Start button:
calls ApplicationMgr.OpenSeequenceFile,
latches the file reference
calls EntryPoint(1).Run
latches Execution reference.
Stop button:
calls ApplicationMgr.CloseExecition(ExecRef)
calls ApplicationMgr.CloseSequenceFile(FileRef)
if both successful - closes references and clears LV controls which keeped both references.
else waits UIMessage code 19 (exec finished), closes referenses and clear ref controls.
When I run demo sequences or any simple test sequences OI works very good.
I can run tests many times repeatedly, stop and close execfution, start tests once more.
When I define in sequence file model callback on file unload and put to this callback simple step with time delay 1 sec and message banner without user input to watch callback, I have a problem ater stop button.
After stop button has pressed nothing happenned right away.
But next attempt to run test leads to error message which says:
can't open file because sequence file unload callback is running.
But I watch UIMessage log and it logs messages with codes 18,10,19,8 after stop is pressed.
It shows: file unload callback is normally executed and finished.
And I am sure: OI has latched UIMessge code 19 (file is released) with my file ID in message parameter.
And in this message handler I have closed references on file and execution.
What may be a reason for locking sequence file after closing in the described situation?
If I have removed file unload callback from sequence file everything once more works normally.
Thanks in advance for any ideas.
Solved! Go to Solution.
08-08-2011 06:12 PM
Hi Anpis,
Thank you for your thorough posting, as the details were very helpful. The difference that I am seeing between the functional program and non-functioning program is the 1 second time delay and the banner. Have you tried doing just the 1 second time delay or just the banner display? Is the purpose of the message banner to monitor the sequence as it is running? You say that nothing happens when you press the stop button right away, so how do you exit the program?Lastly, what is the approximate time delay between the program exit and restarting it? I apologize for the bombardment of questions but I just want to make sure that I have a clear image of what is going on. I look forward to your response and hope you have a great day!
Regards,
Jackie
08-09-2011 01:07 AM
Hi, Jackie!
Thanks for responce.
Now I have solved this problem.
My mistake was wrong understanding parameter passing mechanizm from callback VI to Labview event handler.
I tried handle file reference in Labview event loop with passing it from callback VI into LV event handler.
I always had wrong file reference.
This way is wrong.
After I have placed getting file ID directly into callback VI, everythinh works normally.
Now I get file ID in callback VI, close file reference here and pass ID into LV event handler.
08-09-2011 03:09 PM
Hi Anpis,
Great! Glad to hear your issue was resolved and thank you very much for posting your solution, as this is very helpful for anyone facing similar difficulties. Have a great day!
Regards,
Jackie