03-13-2016 01:43 PM
Hello, I posted a question regarding the same dilemma last week, however the responses I recieved were unsuccessfull.
I am using the queued message handler template to control two analogue outputs from a myDAQ.
The program is based around three events which supply different voltages for user defined time periods. The problem is when these events are triggered the program goes into the relevant sub vi, where I have used flat sequence structure to perfrom the voltage ouputs in a sequential order. However when the 'exit' button is triggered the program will not exit until the user defined time period set at the main vi is over. I would like the 'exit' case to superseed anything else, hence interrupting any events that are occuring.
I have made the exit case a priority message with the use of the abort funtion, however still no luck! It seems such a simple piece of functionality, but I simply cannot get this to work. Does anyone have any ideas?
I have attched the code below.
Thanks!!
03-13-2016 02:00 PM
One of the problems with sequence structures is the fact that they need to complete all frames before the subVI can return. Instead, you should rewrite your subVI as a state machine that is aware of the sutdown state more fine-grained intervals. It would also eliminate many of the local variables.
03-13-2016 02:47 PM
@SamWood wrote:
However when the 'exit' button is triggered the program will not exit until the user defined time period set at the main vi is over. I would like the 'exit' case to superseed anything else, hence interrupting any events that are occuring.
There are a few options here.
One is to use a global variable to tell the FOR loop inside of your subVI to abort early with the conditional terminal.
The second option would be to turn your QMH into more of a state machine by enqueueing wait, read, and check time states until the number of samples is taken. If those are normal priority states, then the abort command will override and allow the loop to stop.