helix_r@my-deja.com wrote:
>
> Hi,
>
> This is a problem that I seem to be running into a lot
> lately.
>
> Suppose that you have a front panel with a bunch of
> buttons (or other controls) and you want each button
> to perform some action (ie excecute a sub-vi) when it
> is pressed.
>
> Is there a way to do this WITHOUT using a polling loop?
>
> What I mean is: can I tie a particular action to each
> button without having to make a loop that checks each
> button to see if it has been depressed?
>
> The reason I ask is that if there are lot of controls
> on the front panel, the loop that checks which have
> been changed can end up taking a long time and/or a
> demand a heavy CPU load.
>
> Does anyone know any tricks for dealing with this?
>
> Something that
can mimic the behavior of windows or
> Java interfaces would be perfect, butI am willing
> to investigate clever polling tactics as well.
>
> Thanks for any assistance,
> H.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
You could try a polling while loop, running in parallel
with your vi. Put a 'wait ms' vi in it, so that it doesn't
hog cpu time (maybe 100 or 200 ms).
'OR' all the button outputs into a digital indicator,
then make a local variable for the indicator. You can check
the local variable, at non critical times, in your main vi.
I haven't tried the parallel while loop + local variable.
My last vi was or-ing local variables of the buttons in
different places in my vi. It turned out a bit of a mess,
but it works.
Walter