LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Noob Question - Buttons seem to hang when being in an event loop

Hi everyone. I hope someone of you knows what I am doing wrong.
 
I cam currently building and application and I tried to stick to Events.
 
So I placed the event structure inside a while structure. Inside this event structure, I added an event (some Button being pressed). In the front panel I added a Waveform Graph. Inside the event for the button, I added a VI of mine, which aquires some data.
 
Now when I run the VI on it's own (standalone, not inside the event), the data wonderfully displays - perfect. When I run the VI inside the other VI within the event. I only get 3 values from my data and the button seems to stick into the front panel ?
 
Am I doing something wrong ?
 
TIA
0 Kudos
Message 1 of 15
(3,452 Views)
Hi
 
Just one tip - use the producer consumer design pattern.
 
Using this you avoid huge operations in the event-structure. Your button should be accessible when the event-case finished execution.
 
Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 15
(3,442 Views)
The event structure has to be allowed to finish so the user interface stays responsive.  Your subvi (while doing its own thing) will keep the event from completing.
 
I use the same model when I design new programs.  Feed a queue into the event structure and when the button is pressed enqueue a new element.  Create, below this loop, another while loop which polls the queue and when this event fires have the aquisition and processing done there.
0 Kudos
Message 3 of 15
(3,438 Views)
I tried the consumer/producer idea ...
 
The Button works better now, but still, I only get 3 values, although I set autoscale to on ... shouldn't it display all values to me ?
 
0 Kudos
Message 4 of 15
(3,435 Views)
We would have to see your vi inorder to tell you what is going on with your subvi, please post your vi. be sure to attach all subvi's this is easily done by going to file save as developement distribution.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 5 of 15
(3,427 Views)
since its in early state, I can do that 🙂
 
 
0 Kudos
Message 6 of 15
(3,427 Views)
Please save in 7.0 format so that me and becktho can help



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 7 of 15
(3,424 Views)
0 Kudos
Message 8 of 15
(3,422 Views)
Oh ... I think I found it *sigh*
 
The type of wire to the graph is wrong *sighs again*
 
Thanks for your help 🙂
0 Kudos
Message 9 of 15
(3,394 Views)

One quick comment:

Why don't you replace the graph local variable with the actual graph terminal? (You don't need any local variables!). Nothing related to the graph needs to be in the upper loop.

0 Kudos
Message 10 of 15
(3,381 Views)