LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pushing Push Button generates two Events "Value Change" -- Why?

Hi,
 
is anybody out there who can explain to us the following mystery? Please, see the attached vi. In a simple state machine two event structures wait sequentially for a "Value Change" event of a push button. If one pushes the button once (and only generates exactly one rising slope), apparently two events are generated as the two counters indicate. It doesn't seem to matter whether the button is "latch" or "switch when pressed". If the button is "latched" it doesn't jump back as it should do.
 
Why is it that more than one event is generated if we push the button exactly once?
 
Any hint highly appreciated.
 
Peter
Download All
Message 1 of 7
(6,530 Views)
no this is expected behaviour.
Both the event structure get the same events.
So by initialy you go to 'First_Event'.
On the event the count goes up and you go to state 'Second_Event', this event case already has received the same event, counts up and the state machine goes to 'First_event' and waits.

This can be seen if you look at the event generation time (a latch will generate two events, a switch one).

To have the behavouir you want you need to have dynamic event registration.

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 7
(6,528 Views)
Hello,
 
why do you need two Event Structures in one VI?? Smiley Indifferent
 
Mike
0 Kudos
Message 3 of 7
(6,514 Views)

Mike,

by the vi we control a lab test stand. The operator needs to do some handling while the software is waiting in the event structure. When he is ready he presses the push button. Later on some other handling needs to be done. Again the software waits until the operator pushes the same button a second time. Hence, the button should be named best "Proceed" or similar.

Due to the problem we described in our post, the code only works properly through the first step. As soon as the software execution arrives at the second event structure, the first event is still stored and the event structure doesn't wait for the operator anymore.

For my taste, the way NI programmed LabVIEW in this case is not very logical. Why is the second event structure already armed although the code execution has not yet arrived at the second event structure?

Thanks,

Peter

0 Kudos
Message 4 of 7
(6,502 Views)
Why not have both instances in a case structure inside your event structure?  Just have a boolean toggle through a shift register or something, and have that describe your next case.
0 Kudos
Message 5 of 7
(6,498 Views)

Hi stoeckel,

what is about this way? -> attachment!

Mike



Message Edited by MikeS81 on 01-15-2008 07:43 AM
0 Kudos
Message 6 of 7
(6,495 Views)

Hi Ton,

thanks for your useful comment. I changed the code to dynamic event registration and now it works as desired indeed. For anybody who is interested I attach the modified code again.

Well, I was able to do the programming but I really don't understand yet what the difference between the conventional event structure programming and the usage of dynamic event registration is. Why does my fist vi not work properly while the second does? Why is -- in the first vi -- the second event structure armed from start of the vi on, while in the second vi with dynamic event registration it isn't?

Peter

Download All
0 Kudos
Message 7 of 7
(6,490 Views)