LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Button that initializes values then releases control of further booleans

Solved!
Go to solution

Ok, At what point in time should the program check the value of the controls? You should really put an architecture into place to allow you to interrupt the program flow when one of the switches is flipped. Take a look at the attached VI, please keep in mind that some of the SubVIs aren't included on my end so they may end up not linked properly. This is not a great architecture but is probably the easiest way to get what you are wanting.

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
Message 11 of 16
(597 Views)

That seems to have done it! Thank you so much.

 

I have a couple more questions if you can put up with me any longer. 

 

Why does the stop button need to remain part of the Event Structure? I clicked it and it broke the continuous updating until I unhid the Dummy Boolean and changed it back to false. I tried deleting it and it broke the Event Structure. 

 

I'm trying to figure out how the Flat Sequence Structure operates. I've never used it before so my curosity is that if I add more calculations to the end, should they be inside the loop? Why does the last cluster get put into the Flat Sequence? Basically I'm confused how the flat sequence forces labview to not read the boolean until the end of the loop. Let me give this a try, since the only data flow is the dummy boolean, it continues to run everything until the event changes. So by not changing the dummy boolean, if keeps the cluster going until the boolean changes. Is that right?

0 Kudos
Message 12 of 16
(589 Views)

@JShultz89 wrote:

That seems to have done it! Thank you so much.

 

I have a couple more questions if you can put up with me any longer. 

 

Why does the stop button need to remain part of the Event Structure? I clicked it and it broke the continuous updating until I unhid the Dummy Boolean and changed it back to false. I tried deleting it and it broke the Event Structure.


That's partially my fault, I should have initialized the value of the dummy boolean. One other thing I should have pointed out, this code will run until you click stop, there is no longer a need to use "Run Continuously". The stop button is required to stop the code, the top loop responds to the stop button being pressed then sets the dummy boolean to true to stop the second loop.

 


@JShultz89 wrote:

 

I'm trying to figure out how the Flat Sequence Structure operates. I've never used it before so my curosity is that if I add more calculations to the end, should they be inside the loop? Why does the last cluster get put into the Flat Sequence? Basically I'm confused how the flat sequence forces labview to not read the boolean until the end of the loop. Let me give this a try, since the only data flow is the dummy boolean, it continues to run everything until the event changes. So by not changing the dummy boolean, if keeps the cluster going until the boolean changes. Is that right?



If the process in the lower loop takes a significant amount of time, we want to make sure that the program quits as soon as possible after the user clicks "Stop". Because LabVIEW is dataflow and trys to do everything in parallel, not using a flat sequence structure on the local variable read will cause LabVIEW to read it very near the beginning of the loop. This will cause the loop to be executed one more time before it reads the stop from the variable. I just threw it in with the bundle and indicator to force LabVIEW to read the variable at the very end of the code loop.

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
Message 13 of 16
(577 Views)

Here's a version that properly initializes the dummy boolean. Please note that there are much better approaches to code such as this, I would highly recommend checking out the Continuous Measurement and Logging template project included in LabVIEW 2012 and beyond. This will show you a much better architecture for what you are doing.

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
Message 14 of 16
(576 Views)

Here's another variation that uses a much cleaner approach. I'm using a DVR (Data Value Reference) to pass the bay values as well as the stop functionality. This allows us a faster way to check to see if the controls have changed (no need to read a local variable). I also check the stop button first thing through the loop then tell it not to execute any of the rest of the code if stopping. This allowed me to get rid of the sequence structure but still not lag when the user hits stop.

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
Message 15 of 16
(567 Views)

This is excellent! Thank you so much for your help. I'm going to study these a bit and try to understand them better. 

0 Kudos
Message 16 of 16
(548 Views)