LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to keep LED lights on

Guys,

I'm having a problem.  The attached .vi has a series of LED indicators and buttons which control these indicators (if you open the .vi and run it, it will become obvious as to what i mean).  In any event, you will see that after you click off one of the buttons and on to another one, the LED that was lit up before clicking off the button and on to the other one goes off as well.  Basically, I need the LED's to remain in their same state no matter what button I am clicking on at that time.  Again, if you run the current .vi you will see exactly what I am talking about.  Any help would be greatly appreciated.  Thanks
0 Kudos
Message 1 of 7
(4,491 Views)
You need to put the terminals of the LEDs inside the event case where they get modified. This way they don't get modified if other events execute. See attached quick modification.
 
Use execution highlighting to see what is going on. 😉
0 Kudos
Message 2 of 7
(4,486 Views)
Thank you for your reply.....I now understand how to keep the lights on.....the only problem now that I am encountering is that when I click off one button and on to another one the previous light does stay on, but when I try to click back on the button that I hit previous the commands don't start from the light that was left on but jump around a little bit if that makes any sense.  I need this thing to work so that if the 3rd LED of the Wheel button is on at the time that I click another button, that when I come back and click on the Wheel button the next light that turns on is the 4th LED.....if you could figure this out, then I would be done working on this thing......I once again appreciate any help you can give me....I've attached another copy of the .vi.  Thanks.
0 Kudos
Message 3 of 7
(4,483 Views)
Your problem is that the lights depend on N, which is global for all event cases. So the LED that lights up, depends entriely on the number and order of previous clicks on any of the buttons.
 
You need to keep a seperate index for each event case that is only incremented in its own event. Shift registers would be the easiest solution. See attached simple example (LabVIEW 8.0). modify as needed.
 
Some more advice:
  1. Don't place all these seperate GPIB nodes in each case of the case structures if the only thing that differs between cases is the string. It is sufficient to have the string inside the case. It is MUCH safer to compute the string instead of having all these diagram constants. (Mistakes such as your string in case 4 of the SET event can easily happen and are very hard to track down. Shouldn't it say SET4 instead of KEY7? ).
  2. It is very tedious to have all these seperate LEDs. Use an array of LEDs and things get much simpler. You can even make the container transparent. Now they are always perfectly aligned and spaced and they can be addressed via a single terminal, dramatically simplifying the diagram.
  3. Try to avoid wiring from right to left (such as you address string). This is very confusing.

See if this makes sense. 😉

0 Kudos
Message 4 of 7
(4,451 Views)
Hey......I don't know if that is going to work because I won't be able to test it till tomorrow.....but I can't tell you how much I appreciate you creating that .vi for me to look at it.....the preliminary test seem as if it is going to work......but like i said...i'll get back at you and let you know tomorrow......Once again, thank you sooooo much.....

Later
0 Kudos
Message 5 of 7
(4,444 Views)
Ok, so it pretty much worked the way i want it to.  I have only a few more questions for you. 

First, is their anyway that when you click on the "Set" button it will turn off the LED for the "Measure" button.  Then when you click back on to the "Measure" button, it will turn off the LED for the "Set" button.  Also, when you click back on the "Measure" button the LED that was lit up before clicking on the "Set" button should be lit up again.  The "Set" button should work in the same way, if this makes any sense.  This isn't very important so if it can be done, great, if not that's cool too.

Secondly, I have put on the front panel an LED display/indicator.  I have a FR*? GPIB read command for this instrument.  When the first LED of the "Measure" button is displayed, I need this indicator to read from the GPIB interface command FR1?.  When the second LED of the "Measure" button is displayed, I need this indicator to read from the GPIB interface command FR2?.  The thrid and forth LED buttons should do the same thing just with the FR3? and FR4? command respectively. 

Basically my problem is right now, that i don't know how to read from this instrument.  The FR*? is a read command but i don't know how to implement any read commands in LabView.  I have attached the new .vi with the code you sent me and some code I added.  The indicator is also now on the front panel.   Once again, thanks so much for all your help.

Andy
0 Kudos
Message 6 of 7
(4,419 Views)
Hi, Andy.

You can have the Set and Measure LEDs turn off by using local variables for your LEDs. Create a local variable for each LED (sync, measure, wheel, etc). Then, to use the example from your question, in the Set case you can just set the Measure variable to false. (And the inverse.)

Also, what sort of instrument do you have?

Have a nice evening!
Sarah K.
Search PME
National Instruments
0 Kudos
Message 7 of 7
(4,403 Views)