LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

generating the events programatically

Hello Everybody
I have read that LV has not support for generating the events (like button click) by program. It means that if I wire random signal generator to numeric and make an event on change the numeric value it will not work.
Even if it is true, I am sure there are some tricks to generate the event programatically, but I do not know how. Could you tell me the method?
Thanks in advance.
Pawel
0 Kudos
Message 1 of 5
(3,071 Views)
Hi Pawel

The way is to simulate a keyboard input and to generate in that way an event programatically. Check this example:
http://zone.ni.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/cea6d68499566a8386256b45006735be?OpenDocument

Luca P.
Regards,
Luca
Message 2 of 5
(3,071 Views)
Thank you Luca

Pawel
0 Kudos
Message 3 of 5
(3,071 Views)
> I have read that LV has not support for generating the events (like
> button click) by program. It means that if I wire random signal
> generator to numeric and make an event on change the numeric value it
> will not work.


Actually, it depends on the version. LV6.1 adds support for user
interface events. If using it, you drop an event structure on the
diagram and configure it for the events you are interested in. You then
place the code to execute in response to an event inside the diagrams of
the structure -- much like a case structure.

If you are using an earlier version of LV, the typical technique used is
to have a timed loop. Often it will execute something like ten times
per second, and each iteration it compares the current to the previous

value stored in a shift register. If it detects a difference, then it
executes some code in a structure. As these become more complex they
often turn into state machines that help to condense the logic of the
UI. With still more complex UIs, people will often use what they call a
queued state machine, which prefer to call an message handler or an
event handling loop.

Anyway, it is probably useful to both experiment with a simpler shift
register based comparison loop looking for one event, and also to look
at the design patterns posted mentioned above on zone.ni.com or
ni.com/labviewzone, or ltrpub.com or pretty much any labview oriented
web site.

Greg McKaskle
0 Kudos
Message 4 of 5
(3,071 Views)
i believe you misread the question and that he was asking about the generation of events programatically, not handling the events (such as with the LV6.1 event handler)

to the poster:
to my knowledge there is not a way to generate events and you are correct that a random number generator wired as stated will not do the trick.
0 Kudos
Message 5 of 5
(3,071 Views)