LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event structure Query

Solved!
Go to solution

I would like to create an event which responds to a button on my front panel and a text entry box which tells the event how often to repeat the code which is inside in the event I have specified.

 

The event should begin executing the code as soon as the button is pressed and repeat the event for example every 100mS until the button is released again.

 

If anyone has any ideas I would be glad to hear them. I use LabView 7.0

0 Kudos
Message 1 of 11
(3,329 Views)

You need to event cases:

 

1. Button:value change:  In this case you set the time out value for the time out case to either 100ms or -1.

2. Timeout: In this case you excute youre code.

 

Default timeout value is -1.

You'll need to shift registers.

One to hold the timeout value and one to hold the state (execute/not execute).

 

Once  the button is pressed the timeout is set to 100ms and the timeout case will begin executing every 100ms.

After a second button press you set the value of the timeout event to -1, thus preveting the excution of that event.

Regards,
André (CLA, CLED)
Message 2 of 11
(3,314 Views)

I still dont undertand exactly,I should create 2 events ? the first one responds to the click of my button but how can I trigger the second event  from this timeout?

And my Control( 100ms 200ms etc) which handles how often to repeat the event where should I connect that ?

Im not very experienced in LabView so excuse my ignorance.

I also couldnt find any shift registers.

 

 

Eoin

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

here is an example of a simple event:

 

also to make a shift register right click you for or while loop and click the add shift register

Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
Message 4 of 11
(3,292 Views)

because I cannot save it in a previous version that low:

 

here are pictures of the block diagram:

Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
Message 5 of 11
(3,287 Views)

I would like to only use one button.

I have attached a shot of my VI, with it like this it executes the code in this window every 500ms, but the problem is it gets stuck and will not respond to the button which should end the while loop or the "POLL" button which means I have to click abort execution for it to stop.

 

 

 

 

 

0 Kudos
Message 6 of 11
(3,279 Views)

well normaly you don't put a while loop within an event structure because if this is event driven than it has to have some sort of event running it (i.e mouse click, value change)

and a while loop would just continuosly run and would cause your other buttons not to work:)

so I would take the while loop out of your event structure.

Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
Message 7 of 11
(3,271 Views)
Solution
Accepted by topic author eoin87
Message Edited by andre.buurman@carya on 05-14-2009 10:42 PM
Regards,
André (CLA, CLED)
Message 8 of 11
(3,250 Views)
There is free course material available on the ni website, maybe a look through one of them won't hurt. Try taking it slow at learning LabVIEW, you're trying to do some more advanced stuff right away.
Message Edited by andre.buurman@carya on 05-14-2009 10:49 PM
Regards,
André (CLA, CLED)
Message 9 of 11
(3,247 Views)
great that works just like you said, but when I hit the stop button I wouldnt like to exit from my main while loop i would like the main while loop to keep running and waiting for events to happen. How can I achieve this ?
0 Kudos
Message 10 of 11
(3,223 Views)