LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event structure executes only once

I am running Labview 6.1 and am new to event structures.  I have set one up that looks for a change in value from one of 4 Boolean buttons.  Each button is set mechanically to “latch when released”.  Eventually these buttons will be used to increase or decrease gain on a 2 channel DAQ process.  But because I am new to event structures, I have not implemented the DAQ yet.  I wanted to first make sure I was getting the event structure to function properly.

 

In the main program I have a sequence structure that first turns on an indicator on the front panel.  The next sequence panel is a for loop that executes 1000 times with a 500 msec wait loop and then an output of the i value to an indicator.  This is just to make sure that the program is executing and hasn’t hung up.  The event structure is in this sequence frame.

 

In my event structure I have a sequence structure that first turns off the indicator mentioned in the above paragraph.  The next sequence frame reads all four Boolean buttons and puts the results into an array.  I index the array and send each value to an indicator on the front panel so I could be sure that only one button was pushed and that the array had the correct button active.  I then use the array to figure out which channel should be changed and whether it should go up or down.  There is logic to prevent increasing past the maximum gain or decreasing past the minimum gain.  I then update the front panel values of the voltage limits (based on the new gain).  The third panel of the sequence structure is a 750 msec wait loop.  The fourth panel of the sequence structure turns back on the indicator that was turned off in the first panel of the sequence structure.

 

When I start the program, the indicator turns on and the counter starts counting.  I press the decrease button for channel one and the following happens.  The indicator goes off (indicating that the event structure is executing).  The 4 indicator lights indicate that the correct button has been pushed and only that one is active.  The limits for channel one change from plus and minus 10 volts to plus and minus 5 volts.  There is a short delay and then the indicator comes back on.  The counter continues to count upward toward 1000.  Everything worked perfectly!

 

Now, if I push any of the four buttons, the button greys, the indicator light does not go out, and nothing happens with my voltage limits.  The counter continues to count upward, but the event structure does not seem to execute the second time.  Help!

0 Kudos
Message 1 of 4
(4,826 Views)
Please attach your code, it would be so much easier to find the problem.
 
Most likely, your event structure never finishes or it runs in paralell with another loop that does no finish, and thus does not not "re-load" ;).
 
Try to run it with execution highlighting enabled and you should immediately see where things get stuck.
 

Message Edited by altenbach on 01-30-2006 03:38 PM

0 Kudos
Message 2 of 4
(4,823 Views)
I tried running with execution highlighting and the event structure seems to execute properly.  It steps through the sequency panels and executes the final panel which is turning the indicator light on the front panel back on.  But if I push one of the buttons again, it won't go back into the event structure.
 
I don't know how to post my code into the forum discussion.  Unfortunately I am leaving for a 3 week trip tomorrow and won't be able to work on this until I get back.
0 Kudos
Message 3 of 4
(4,786 Views)
It sounds like you do not have the event structure in a while loop. If that is the case it will only execute once. The event structure is a good place to put all of your buttons and switches and possibly other front panel controls.

Most experienced LV programmers tend to avoid the use of sequence structures. A state machine architecture can handle all the things you described with much greater flexibility.

Lynn
0 Kudos
Message 4 of 4
(4,779 Views)