I am trying to terminate a while loop nested inside of another loop that is running in parallel with a third loop. Within the nested loop I typically have an FFT happening collecting continous Analog Input data from a PCI-4461. I am having issues terminating the nested loop and need some help. Please take a look at the attached example VI and let me know if there is a better method.
You are seeing this behavior becuase the Event Structure will, by default, lock the front panel while it is running the code in it's events. You can edit events handled by that particular case to avoid locking the front panel if you want to though.
If you tell us more about what you are trying to do we can offer up suggestions for an architecture but nested while loops (and multiple stop buttons in particular) are usually not recommended.
Your code is inside out. Your upper while loop makes no sense at all. Get rid of it.
In the main loop, all you need is a single while loop. Then you modulate the timeout from -1 (infinite) to 50ms, depending on if you want to run the loop in the timeout case or not. At any time, you can switch the timeout by pressing one of the buttons.
Your buttons have incorrect mechanical action. If [start] is switch action, you don't need the stop button, because all you need is turn the same button off to stop, right? I would not use a switch, but a button. Now you could even change the boolean text according to the state. (See attached)
If you want two buttons to control the timeout, they should both be latch action.
The exit button should always be latch action.
Not quite what I am trying to acheive but close. I would like to open the front panel of a VI with a Multifunction FFT but have it sit and wait to run the nested Continous FFT code until the operator has a chance to change front panel settings. Once the operator is happy with the settings they can click a "Start FFT" button and it runs a continous FFT based on the settings they entered. Once they are done running the FFT they would click a "Stop FFT" button and the VI would then exit the inside while loop and go back to the outside While loop and wait for the operator to change settings and click the "Start FFT" button again.
Attached is your VI that I modified by dropping in the FFT code. It will obviously not run as coded as I just dropped in the nested FFT code to give you an idea. The FFT is based on the Sound & Vibration example Multifunction FFT code.
I do not particularly need to use the Timeout event as my thought was to use a "Start FFT" event that would kick off the FFT code. I only wired up the timeout to keep the outside while loop cycling. My idea was to use the top loop as a producer monitoring button clicks and the bottom loop event case acting as a consumer of those button clicks. This way if you press the "Exit" button or the tets operator closes the Windows close 'X' glyph while it is in the middle of capturing a live FFT I could have it terminate and exit gracefully without having to click the "Stop FFT" button first. I was looking for a way to keep the front panel buttons available for click events no matter the state of the VI.