LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to EXIT the while loop in Event response section?

I'm writing a program to grab image using a NI card. The application uses the Event structure. When the GRAB button was pressed, it snaps image continually by putting the SNAP function in a while loop. Is there some way to exit the while loop?(Note :The while loop was put in the GRAB IMAGE event response section.)
 
 
0 Kudos
Message 1 of 11
(3,609 Views)
Hi Zpyang,
      How to stop a while loop...?
... Assuming you mean by operator-intervention,
    why not test a front-panel control (boolan switch) value?
(if this doesn't work, pls attach the main VI (or example) 🙂
 
 
When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 2 of 11
(3,592 Views)

Thanks first.

Of course a boolean variable can be tested(boolan switch). But...

when the system is processing the GRAB event, before the while loop exits, it seems that there is no way to change the value of "boolean switch". So now the while loop is waiting the "stop switch" to change its value to true, at the same time the "stop switch" is waiting the while loop exits so its value can be changed. The program locaked here.

 

 

 

 

 

0 Kudos
Message 3 of 11
(3,587 Views)

Hi Zpyang,

      Since I can't see what's going on (no attachment!) I'm going by the original description - a while loop executing inside an event-case.  See pic.

Since this example works, please describe how your code is different!

 

On the FP you will see the inner-loop-counter stop counting when Boolean becomes true...

Message Edited by Dynamik on 11-13-2005 12:13 AM

Message Edited by Dynamik on 11-13-2005 12:15 AM

When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 4 of 11
(3,586 Views)
Thanks again.
 
Your code certainly work.
 
In the attachement, there is a while loop in the GRAB event response. Here, I want to exit the while loop by checking the status of the "Stop Grab" button.
When the "Grab" button was pressed, the while loop was excuted until the "Stop Grab" or the "Exit" button was pressed. But, when system enters the while loop, there is no way to change the status of either "Stop Grab" button or the "Exit" button, so the system got locked.
 
My question is by what means I can change the status of the "Stop Grab" button.
 
0 Kudos
Message 5 of 11
(3,575 Views)

edit this event-case AND uncheck "lock front panel until the event case for this event completes".

BTW, your thanks should go to Ankita, <a href='http://forums.ni.com/ni/board/message?board.id=170&message.id=151282'>here</a>

cheers! 

...

Message Edited by Dynamik on 11-13-2005 01:26 AM

Message Edited by Dynamik on 11-13-2005 01:38 AM

When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 6 of 11
(3,566 Views)
Finally, we can exit the while loop!
 
Now... do the following:
 
1 Press "Grab";
2 then press "View Results" (There is an Event case for "View Results").
 
You can find the program got locked again...
 
So, we still have something to do.
 
 
0 Kudos
Message 7 of 11
(3,554 Views)

Hi Zpyang,

      I'm glad we're making some progress!

      I will gladly help if you will please attach some example code (in LabVIEW 7)

cheers!

When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 8 of 11
(3,547 Views)

Thanks a lot.

I'll upload the source code(VI file) tomorrow. It was in my office computer, now it's unavailable.

0 Kudos
Message 9 of 11
(3,545 Views)
The attachment is my VI.
 
0 Kudos
Message 10 of 11
(3,521 Views)