LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Button Fire Event Multiple Times

Hey everyone.  I've somewhat inherited a LabVIEW program for a project I'm working on.  I need to fire an event in an event structure 20 times in a row to fully collect my data.  Right now i just have the event structure connected to a slider so i just slide it enough and it completes the 20 events needed.  Is there a way I can make one button fire an event 20 times?  I need the while loop for the entire program to run during these 20 times so a simple loop around the event code won't work.  Any ideas?  Thanks guys.
0 Kudos
Message 1 of 5
(2,761 Views)

Hi SteveCRM,

can you please explain what you make in your event? Why do you need it 20 times? You could use the value(signaling) property, but that´s not a good way to do it. Please explain what you make there, i´m sure there is a better solution for you.

Mike

0 Kudos
Message 2 of 5
(2,756 Views)

Often you can also assign the timeout case to the same event and if the event triggers the first time, set the timeout to zero (via a shift register) and start counting how many times the event executes. Once it has executed 20 times, set the timeout back to -1 (infinite).

0 Kudos
Message 3 of 5
(2,753 Views)
Yeah my problem is kind of strange.  Heres whats going on:
 
I have an image 128x128, which is also 20 images deep.  So essentially I have a 3d array, or a 1d array of images.  each event takes an image from a shift register.  Because this data comes from the shift register i need to allow the rest of the program to run because an image will only be delivered once every loop of the overall while loop.  So each time this event is fired one image from the shift register is loaded and stacked onto a large 3d array.  I do this until the 3d array is complete and I can begin doing operations on the entire stack.  So I'd like to be able to load all 20 images on one button click.  The code was pretty much all complete so i wouldn't really like to change the overall structure of this program much.
0 Kudos
Message 4 of 5
(2,751 Views)
I'd use another solution.

When the button is pressed, start a dynamic VI that does the aqcuisition.
When the VI is done, it sends a user event (or a value (signalling) event to
some control), so the main VI knows it's done. By doing this, you seperate
the DAQ and the MMI, which is good. Both VI's are kept simple. Put the data
in a buffer, or pass it in the user event data.

Timing and event structures are difficult. It's very inconvenient to exectue
an event case every X sec. without using a dynamic VI (or parrallel loop).
Using the time out event has it's own problems. The TO event is called when
no other event occured for the given period. So if you'd add a mouse over
event (as an example) the TO case isn't called at all when the mouse
moves...

You could also start a dynamic VI that creates a user event (or value
(signalling) 20 times at some interval, and then quits. But it's just as
complex as a dynamic DAQ vi, and less elegant.

Regards,

Wiebe.



0 Kudos
Message 5 of 5
(2,714 Views)