LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While loop takes control of everything, i.e. stop a while loop

Hi everybody,
I have a problem with a while loop, which I don't manage to stop as it
takes control of everything.

So, the problem is the following.
I wrote a vi to control an Optical Spectrum Analyzer and I need it to
scan a trace every Ta seconds. The scan must start when the user
presses the button "Start datalogging!" and must stop when the user
presses the button "Stop datalogging!" (this button is configured as
"swith after pression").
The problem is, anyway, that after starting the datalogging operation,
the user interface becomes kinda inaccessible, the mouse pointer
assumes the "hand format" and you can't push any button (actually you
can't move the scroll bars either, nothing), but the one to abort the
execution, making thus impossible to stop the acquisition or any other
operation.
It seems like the operation of collecting data is so "CPU consuming"
that LABVIEW can't "listen" to any input.

The LABVIEW version I am using is the 8.5.1.

I hope somebody can help me solving this problem.

Thanks a lot,
Gianluca
0 Kudos
Message 1 of 7
(3,106 Views)

Problem with event srtucture?

 

Right Click the Event Structure --> Edit Events --> 'highlight each event'-->  Unlock

Message 2 of 7
(3,094 Views)
Post your Code if possible
0 Kudos
Message 3 of 7
(3,091 Views)

Hi,

 

You may want to try the following:

1) create a while loop, leave the conditional terminal open for now

2) inside the while loop, create an event structure (on the same palette as 'while'- and 'for' loops)

3) Add an event by right-cllicking the top textfield of the event structure, choose your startbutton-control in the left menu, and in the right menu scroll down to 'value change'. Before exiting this menu make sure to uncheck the checkbox for 'lock front panel'

4 inside the eventstructure for your start-button, put your start-button control - it needs to be read by the program to work properly (unless you chose another form of mechanical action). Wire it through the wall of the event-structure and to the conditional terminal, insert a boolean 'not' to reverse the polarity.

5) Add a constant to the 'timeout' value on the left upper corner (outside the event structure),give it the value 100 [ms]

6) select the timeout page in the structure (it was there by default as the first page)

7) insert your scanning program in here, it will iterate (start) every 100ms (due to your constant in step 5)

😎 add another event, select your stop button control in the left menu, select 'value change' in the right menu

9) Place your stop-button control inside the new page in the event-structure, wire a line through the frame down to the conditional terminal

10) you are done 🙂

 

Brgds

T

Message 4 of 7
(3,081 Views)
Solved.

The while loop was inside an event structure and the event was set so
to lock the front panel before the end of the execution.

Gianluca

On 22 sep, 10:07, Gianluca Coviello <coviello...@gmail.com> wrote:
> Hi everybody,
> I have a problem with a while loop, which I don't manage to stop as it
> takes control of everything.
>
> So, the problem is the following.
> I wrote a vi to control an Optical Spectrum Analyzer and I need it to
> scan a trace every Ta seconds. The scan must start when the user
> presses the button "Start datalogging!" and must stop when the user
> presses the button "Stop datalogging!" (this button is configured as
> "swith after pression").
> The problem is, anyway, that after starting the datalogging operation,
> the user interface becomes kinda inaccessible, the mouse pointer
> assumes the "hand format" and you can't push any button (actually you
> can't move the scroll bars either, nothing), but the one to abort the
> execution, making thus impossible to stop the acquisition or any other
> operation.
> It seems like the operation of collecting data is so "CPU consuming"
> that LABVIEW can't "listen" to any input.
>
> The LABVIEW version I am using is the 8.5.1.
>
> I hope somebody can help me solving this problem.
>
> Thanks a lot,
> Gianluca

0 Kudos
Message 5 of 7
(3,056 Views)
Mine mine mine. Mark mine as the accepted solution!!!:smileyvery-happy::smileyvery-happy::smileyvery-happy:
0 Kudos
Message 6 of 7
(3,054 Views)

Competition, eh? 😉 

0 Kudos
Message 7 of 7
(3,040 Views)