LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Just want to cancel my programm !?

I've only a simple programm where I'm getting some instrument data over my GPIB interface,
the values are being updated in a seperate while loop including a time delay of about 5sec.
 
Outside this loop I do some adjustments.
 
Only thing I want to add is a cancel button, but it doesn't work neither within the loop nor
outside.
Only buttons working in my application are the event buttons to start the measurement.
How can I implement this additional button e.g. to cancel the complecte program - or
to reset e.g. my connected instrument values during the running labview programm.
 
Would appreciate some help - thanks 
0 Kudos
Message 1 of 12
(3,258 Views)
maybe you can post your VI?

Are you ending your event structure with the exit button as well? It sounds like you have an evetn structure and a loop??
0 Kudos
Message 2 of 12
(3,254 Views)
Correct, I have several event structures, with which I'm getting my
button events - during pressing the measure butten I jump into my
loop within this loop - during runtime of the whole program I want to
add a button to cancel the entire program....
0 Kudos
Message 3 of 12
(3,239 Views)

Post your vi so that we can see the code.  Its hard to tell you how to do something without seeing the code.

It is not usually a good idea to have several event structures.  You should have one event structure handling several event cases.  This could be your problem.  The program will stay open until all event structures have seen at least one event.

- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 12
(3,234 Views)
Generally speaking, you should avoid multiple event structures.  It can be very difficult to predict which structure is waiting for any given event. 
0 Kudos
Message 5 of 12
(3,232 Views)
Same problem there seems not to be any reaction of my input button during
the programm is within the loop !
So I didn't get it run !
I just want to pause or to stop my
little programm with an additional button during counting any
suggestions ?
See the attached file.
0 Kudos
Message 6 of 12
(3,215 Views)
Your pause button never gets read while the small loop is spinning, because the terminal is outside the loop. The pause terminal needs to be inside the small loop. You don't need a case structure. If pause is false, the loop stops and exits after one iteration and does not block anything.
 
Still, you should place a small wait (a few ms) inside the pause loop so it does not consume 100% of your CPU while paused.
 
You also should replace the FOR loop with a while loop, so the program can be interrupted (stopped) at any time.
 
Attached (LabVIEW 7.0) is a quick modification of your code. It seems to work just fine.
 
NOTE:
It would probably be better to use the big outside loop for counting (e.g. by using the timeout event). This way it does not block any other event cases.

Message Edited by altenbach on 04-01-2006 02:19 PM

0 Kudos
Message 7 of 12
(3,212 Views)
An here is an example using only the outside loop. Now all event can execute immediately at any time, because no slow event case is blocking them.
0 Kudos
Message 8 of 12
(3,207 Views)
Thank you for your help, I continue...
0 Kudos
Message 9 of 12
(3,190 Views)
Ok thank you very much, it worked fine so far,
the main problem in my case was the set chekmark in my event
structure to prevent my frontpanel from responding...

But what can I do to read one Button from my Frontpanel in
different event cases or loops - I created for the button
a single local variable, but then I'm getting an error
message that LabView cannot handle the Button with "Latch" behavior.
What can I do to prevent this ?

See the attached file - my two local variables inside the two different
events.
0 Kudos
Message 10 of 12
(3,174 Views)