LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

executing event structure within while loop within sequence

I'm using an event structure within a while loop within a sequence structure to cause one event repetitively (every time the user changes a button value), then exit the event structure/while loop in the other event.  Somehow, my program seems to hang here.  I can press my button once, but then it locks and won't change.  Is this because the button is not within the while loop?  Do I need to update the value somehow?  Thanks.  Jonathan
0 Kudos
Message 1 of 13
(3,686 Views)

here is an image of the code in question:

0 Kudos
Message 2 of 13
(3,663 Views)
I can't get the html right for posting the image- here's the link:
the image is the file caseimage.gif
0 Kudos
Message 3 of 13
(3,664 Views)
I still cannot read the image when I follow the link. All I see when I click the caseimage.gif is a blue strip near the top of my screen. Of course I may be the only person with this issue.
William Griffin
NI Certified LabVIEW Architect
NI Certified Professional Instructor
Spark Embedded
https://sparkembedded.com/
0 Kudos
Message 4 of 13
(3,649 Views)
You're not the only one.   I also only see a small blue bar...
0 Kudos
Message 5 of 13
(3,645 Views)

to uplpoad an image, simply attach it to the post, (at the bottom of the text edit area, there is a button to browse attachments).

but just from your description, something bothers me:

an event structure within a while loop - up to now no problem.
then the whole thing within a sequence structure - what will happen normally, is as your sequence is performed during runtime, you will reach the while loop. this one waits to either an event to occur, either timout. if the while loop is wired to a stop button, this button should be handled by a special "stop"event in the structure, with the button connected from this event to the loop stopper.

Then (and only then), the rest of the sequence can perform.

notes:

1) you might want a "latch when released" mechanism for the loop

2) you can put the stop button in the timout event if prefered. define some time for the timout (i.e. 50ms)

 

Message Edited by Gabi1 on 09-06-2007 05:59 PM

-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
0 Kudos
Message 6 of 13
(3,640 Views)
finally, here is the image.  I do have a stop condition wired- I even wired a continue condition (output false to stop while loop) in the case that I only execute the case that I want to repeat.  Suggestions?  I think that for some reason, this might work if I make it a sub-vi, but won't be able to check until I get to my desk this afternoon.
0 Kudos
Message 7 of 13
(3,633 Views)

your event structure while loop has a "stop if true" condition, yet it is connected to a constant with value "false" when event 1 (single pulse) is called.

what are the other events? is there an event where this becomes true? check the conditions!

note: the default value for a boolean connection out of the structure is false. therefore, there is no need to connect every instance of it, only the ones that are transmitting a "true" value out.

-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
0 Kudos
Message 8 of 13
(3,628 Views)
Yes, there is an event that will output a true to the stop terminal. 
0 Kudos
Message 9 of 13
(3,623 Views)
That little snapshot also shows the use of a number of local variables. While not likely to be your problem, local variables should be used sparingly as they easily lead to race conditions. In general do not use a local variable if the same can be accomplished with a wire, and I'd guess that several instances in your code are like this.
0 Kudos
Message 10 of 13
(3,612 Views)