11-22-2010 04:10 PM
This question has probably already been asked but couldn't quite find a solution to it with searching. I am running LabVIEW 8.5 and am wondering if there is a way to know when a user pauses the code. Thanks
Regards,
Anthony Maglio
11-22-2010 04:43 PM
11-22-2010 04:53 PM
I just want to be able to know if it has been paused or not. The reason is because, on occasion we will pause our code during a test and sometimes change instruments settings. I want my program to know if it has been paused so it can make sure to restore instrument settings regardless of what we have set manually.
11-22-2010 05:41 PM
It sounds like you are distributing source code and the user is running the code in the development environment. Typically one does not do this. Typically one builds an application and delivers that. If you want the user to have the ability to "pause" the test then you'd provide that capability yourself by using a system architecture like a state machine. I have not checked, but it's possible that scripting may be able to tell you, but even then you'd have to have some sort of parallel VI (built into an app) running that continuously monitors to see if the development environment has been paused and then potentially use the VI Server to run your "reconfiguration" VI. Sounds like a kludgey approach to me.
11-22-2010 05:42 PM - edited 11-22-2010 05:43 PM
The toolbar has no reason to be visible in an end-user application, so pausing a VI should not even be possible.
Make your program into a state machine, with one state being idle. Your code will know at all times if it is in the idle state.
EDIT: Saverio, I could not have said it better myself :D)
11-23-2010 05:48 AM - edited 11-23-2010 05:49 AM
If you don't have the LabVIEW Application Builder, I would suggest disabling 'Show toolbar when running" Under VI Proerties -> Window Appearance -> Custom. The users will not see the toolbar and will not be able to 'pause' the application.
Add your own pause button and state in your code and perform the steps necessary when a pause has occurred.
Manually changing the configuration of an instrument during a test effectively renders the results invalid. If you need to prevent the operators from tinkering during the test, some GPIB instruments support a LLO (Local Lock-Out) mode that can be configured to disable and enable the instrument's keypad.
11-23-2010 10:11 AM
So, back to the original question, which actually raises some questions:
(1) First of course, the program cannot detect its own paused state, because, well, it's paused so it cannot do anything at the moment!
(2) This leaves us the possibility of an externally running "watchdog VI" that monitors the state of the original VI in memory and will take appropriate action under some conditions. If scripting is enabled, there is a boolean property "is VI paused?". This should work!
11-23-2010 10:28 AM
Hi,
one more possibility:
When the VI itself should only check if it has been paused it could use a simple parallel loop for doing the watchdog.
In case of pausing the VI the iteration time of the parallel loop should be changed from normal behaviour...
11-23-2010 10:37 AM
Gerd,
I think we are talking about the pause button on the tool bar, a debugging tool.
If the VI is paused, any loop will be paused so I don't see how this should work.
11-23-2010 11:29 AM
If you really want to you could take time stamps every so often and compare the current and the last one. Any large deltas could suggest a pause condition.