From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Stopping QMH program when in a sub vi

Hello,

 

 

The desinging of my program is to control two analogue outputs, which range between postive and negative 10 that depend on the user from the input. After a google search the producer consumer architecture with events seemed like a great place to start. I then developed this program, with all requied functionality, however the problem I have is that the stop button will not work when entering the sub VIs within the program (see attached file). After another google search the use of a queued message handler was mentioned to be the best option due to the ability to be able to prioritise the tasks. However, I have swapped over the functionality, but seem to be stuck with the same issue regarding stopping the VIs when is operation (see attched file). Can anyone point me in the right direction using the priority functionality of a queued message handler?

 

Thank you! 

Download All
0 Kudos
Message 1 of 5
(3,611 Views)

When you press the Shutdown button, you need to send the Exit state, not whatever test is running.


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 2 of 5
(3,607 Views)

Thanks for your reply!

 

The problem is not sending the exit state, it's interrupting the while loop within a sub vi during its operation, as therefore it won't shutdown untill the subvi has finished. Apologies for not making this clear. I have attached the full project so you can see what I mean.  

 

Much appreciated!

 

 

0 Kudos
Message 3 of 5
(3,599 Views)

Ah, now I see it.  The solution is actually quite simple.  You should not have a loop in your subVI.  Instead, you have the case enqueue itself.  This way the same state will be called until another state gets put in the queue by the event loop.


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 4 of 5
(3,597 Views)

Thanks for the help!

 

I am still not 100% as to what you mean regarding 'have the case enqueue itself'. I have made the additonal changes you attched in the image file. Also removing the while loops and replacing them with case structures. As for the next step I'm a little stumped.

 

Thanks again!

0 Kudos
Message 5 of 5
(3,586 Views)