LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Same Bool for Initiate and Update (Simple Question)

Hello,

 

I am just starting labview 2010 so this question might be very simple. However I couldn't find any answer by searching an introduction book, this or other forums.

 

The task is very simple: I want a bool which I can initiate before I start the program AND which I can change when it is running. The latter itself appears to be not straight foward itself, as it is not the "classical stop-the-loop scenario".

 

I came up with two versions (see attachment):

1) With the bool outside (lower part in vi), I can press the button before the program is executed, and the program does what I want, except I cant set it during excecution (as expected). And for some reason the button does not appear pressed down, although both LED and progamm indicates it's doing the right thing.

 

2) With the bool inside, it is reset to FALSE every loop for some reason.

 

Any suggestions or links to existing answers would be highly appreciated!

 

Thanks,

Armin

0 Kudos
Message 1 of 9
(2,833 Views)

You can use a local variable to set the boolean control value inside your code.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 9
(2,830 Views)

Note that some of those booleans are latch action, which is why they pop back up after they are read.  With latch action booleans, local variables aren't going to work.

0 Kudos
Message 3 of 9
(2,828 Views)

Thanks. I wasn't aware of the different boolean options. A combination of changing the type, adding a local variable (Thanks to Mark)  and using an 'if' function, finally works. I am just curious why it appears so complicated for such an easy task...

0 Kudos
Message 4 of 9
(2,818 Views)

@Al2 wrote:

The task is very simple: I want a bool which I can initiate before I start the program AND which I can change when it is running. The latter itself appears to be not straight foward itself, as it is not the "classical stop-the-loop scenario".

 

Any suggestions or links to existing answers would be highly appreciated!


You are approaching this the wrong way. There should never be anything that needs to be set before the program runs. Edit mode should not be part of operating the VI!. If you need to change it before the loop runs, use a state machine architecture where, after pressing a run button on your front panel , the program first starts out in an idle state, after which you can proceed to the loop state.

 

Press the run arrow before any user interaction. Only stop the program once you are completely done. Once your program is finalized and built into a standalone application, it will reun when opened and edit mode is not useful anyway.

0 Kudos
Message 5 of 9
(2,811 Views)

im thinking of making two VI's. One where you set the values and the other one that loads those values and runs for iteslf

0 Kudos
Message 6 of 9
(2,809 Views)

@Motanum wrote:

im thinking of making two VI's. One where you set the values and the other one that loads those values and runs for iteslf


 

Why would you want to double the complexity for such a simple problem???
0 Kudos
Message 7 of 9
(2,804 Views)

Because I am not very proficient with LabView and I just shouted a solution which I thought of. Plus, I dont think doing two VIs is that complex. Just take all data in an array and then extract it on the other VI

0 Kudos
Message 8 of 9
(2,802 Views)

-------------------------------------------------------

You are approaching this the wrong way. There should never be anything that needs to be set before the program runs. Edit mode should not be part of operating the VI!. If you need to change it before the loop runs, use a state machine architecture where, after pressing a run button on your front panel , the program first starts out in an idle state, after which you can proceed to the loop state.

 

Press the run arrow before any user interaction. Only stop the program once you are completely done. Once your program is finalized and built into a standalone application, it will reun when opened and edit mode is not useful anyway.

-------------------------------------------------------

 

That seems to be a good point. I'm working with a lot of vi's that are quite complex and made by other people. This whole presetting thing in a non-started vi was always suspicious to me, i.e. nobody used a state machine. I will try it. Thanks

 

0 Kudos
Message 9 of 9
(2,785 Views)