Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

QMH Will Not Stop

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!!

 

0 Kudos
Message 1 of 3
(3,574 Views)

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.

0 Kudos
Message 2 of 3
(3,567 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 3
(3,562 Views)