LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Front panel events capture

Hi, all,

    Current I am working on a test system that is able to capture and log selected front panel events.  For example, I pressed a control button A to power on some circuits, then a Status Button B shows that the circuit has been turned on successfully. In the Events Log, I want it shows "hh:mm:ss  control A turned ON; Status B ON successfully."

    I understand that it can be done using event structure. However, in my system, there are 120+ command and status buttons. Do I have to create 120+ events to do that? Or is there a way to bind them into a something like a tree, in which I can use one event to capture all these events?

    If my description is not clear enough, i can post the picture of my front panel UI later.

Thanks a lot !

Regards,

SeanZ


0 Kudos
Message 1 of 11
(4,078 Views)

you may bundle these variable(s) (indicators/controls) into a cluster then make the event log to react on the changing of this cluster. I think in this way you can solve your problem.

I hope that I could help you.

0 Kudos
Message 2 of 11
(4,074 Views)
Thanks, Amro.

I will try that method and see the results.
0 Kudos
Message 3 of 11
(4,069 Views)
Found a pretty easy way for what you want to do.

You can get the Front Panel Controls via property nodes an register an event dynamically.

Details:
A first property node is set to class VI, the property to read is Front Panel.
The second property node is for the FrontPanel and the property to read is Controls[].
A dynamic event registration takes this array of controls (I was surprised that this works), use the Value changed Event.
Then you wire that event to the dynamic event terminal of the event case.

You will find in the event structure that you now have a Reference to the Control that triggered the event.

Felix
0 Kudos
Message 4 of 11
(4,067 Views)
Attached is the code to do the trick:


Felix


Message Edited by F. Schubert on 04-16-2008 06:01 AM
Download All
Message 5 of 11
(4,062 Views)

@ F. Schube…
it is also a good way, then he must use returned control Names (Labels) to know which control/Indicator has been changed, and upons can fire the function he needs.

good job F. Schube 🙂

0 Kudos
Message 6 of 11
(4,046 Views)
Hi Amro,

thanks for your applause.

But I think you don't see the great benefits of that (mine) solution vs. your clustering. You could make the code I posted a SubVi with the reference array as an input. So you can drop it for any FP in your app without much (re)coding. And this I would guess is really usefull, cause logging (as posted in the first request) is very important to debug apps after shipping (so ctrl.X is pressed in status Y and error Z happens, finding that really nasty race condition a year after development....).

Second is, that in the first post, the name of the control was mentioned, thats why I chose that property from the list. You could use any other property (e.g. only boolean controls are of interest) to filter the events. Putting all into a cluster will always add the nessecity to have a comparrison algorithm, which of the elements changed. For me, this is an important increase in flexibility to *filter* what to log.

I used that trick for a bigger app (it contained about 30 XY-graphs)  when I had to add additional functionality to these controls. Yeah, I live pre-XControl, but changing all ctrls to the appropiate XControl is even more coding than drop a VI and a property node on each VI. Ok, I now get philosophical as the evening gets late. But the power to control our FPs dynamically is often underestimated (and therefore LabView is underestimated).

And least: with the idea to do it, took me 5 min to code. And 5 min of fun. Bringing 120 Ctrls into a cluster and fixing the broken code, no fun.

Good night.

Felix
0 Kudos
Message 7 of 11
(4,018 Views)
Thank you so much, F. Schube..., for your code and explanation.

Your code works great in the system. I can filtered out Boolean controls out of all other kinds of controls easily without much efforts.

Amro, Thank you also for the time and help.
0 Kudos
Message 8 of 11
(3,997 Views)
sorry, F, Schube...

one more question.

If I want to expand the event log message, instead of saying "Control A value changed", I want it displays "Turned ON" when I on the Boolean control and "Turned OFF" when I off it. I need the value of the boolean control to be returned in the event structure in your sample code. but the value of control is variant type. I understand that if this boolean is of latching mechanism, it will always return an error due to possible race conditions.

In this case, when the event structure detects a value change of the control, how can I read the updated value (from the boolean control which is configured as latching)?

Thanks again for your time and help.

Regards,

SeanZ
0 Kudos
Message 9 of 11
(3,992 Views)

Hi SeanZ,

you can use the "to more specific class" function to get a "real" boolean reference. To use it you should use the class ID of the currently used reference and depending on that change it to boolean or numeric or something else. This is possible if you have a boolean without Latching function.

If you use a button with Latching function, everytime you press this button the value is for a short time true and after the control value was read the value is false. So in your case you can show everytime a message box with the message "button xy was pressed".

Mike



Message Edited by MikeS81 on 04-17-2008 08:05 AM
0 Kudos
Message 10 of 11
(3,990 Views)