LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling Front Panel LEDs

This is hopefully a simple problem, but I can't figure out what to search under.  I have a program with two loops (Z Only Test and Full Test in Tester Program v2).  They do not run at the same time.  I would like both loops to interact with an LED on the front panel (Testing).  How is this done?

 

Under Z Only Test, it works fine.  I tried to connect it to the sequence (Full Test), but it tells me I can't do that.  On odd sequences, for the most part, I would like to have the LED light (TRUE).  On evens, off.

0 Kudos
Message 1 of 5
(2,676 Views)

Use a another shared variable?  You already have one set up for that.

 

Use a local variable of the indicator since it seems you want to interact with that boolean LED from within the same VI.?

0 Kudos
Message 2 of 5
(2,672 Views)

Do you mean make the LED a shared variable?  How do you do that?  I clicked on it and changed it to a variable, but I thought that was like one of the others that I have.  I'll give it a try and see what happens.

 

I would assume whatever works for this would also work for numerical displays as well.

0 Kudos
Message 3 of 5
(2,669 Views)

rbergs wrote:

Do you mean make the LED a shared variable?  How do you do that?  I clicked on it and changed it to a variable, but I thought that was like one of the others that I have.  I'll give it a try and see what happens.

 

I would assume whatever works for this would also work for numerical displays as well.


No.  I'm not even sure exactly what you mean by clicked on the LED "and changed it to a variable."

 

Right now you have only a single place where you use that LED.  It has a terminal node on your block diagram within a while loop.  I don't know how that fits into your overall program architecture as your VI is quite expansive.  (Two tips, 1.  Don't use stacked sequences.  2.  Look into a state machine architecture)

 

All that happens at that point is your read from a shared variable called "Testing".  I'm not sure from where else in your VI that you want to interact with that front panel indicator.  Or whether it will conflict with the already written piece of code.   I also don't know where this shared variable is written to. But the first idea is have the other sections of the code write to the shared variable and let this one update the front panel indicator.

 

The second idea is to create a local variable of the front panel indicator.  Right click on the terminal within your code and select Create / Local Variable.  But again, you will have to be careful with conflicts with the different portions of your code writing to the LED.  This is also known as a "race condition".

 

(Yes you can use either shared variables to store numeric data, or create local variables of numeric controls or indicators.)

 

I'm a bit nervous about your code.  It looks like you have a decent amount of LV experience as you have created quite a sophisticated VI there.  However, it doesn't seem like it is easy to expand or modify.  It takes up quite a bit of screen real estate.  It doesn't use any subVI's even though a lot of the code seems to be duplicated or very similar.  And it seems like it uses a lot of shared variables, probably more than necessary.

Message Edited by Ravens Fan on 05-29-2009 01:38 PM
0 Kudos
Message 4 of 5
(2,653 Views)
I was in the middle of making a simple example, and for some reason found the choice to make it a local variable. Problem solved.

Yes, I will admit, currently the VI is a bit of a mess. This is because I was trying to do the process a different method and ran into a roadblock, so I was trying different methods (hence the v2 after the name).

I realize I could make sub-vi's for the motor driving and data collection loops. I am the 'guinea pig' with programming a cRio to drive a machine for our lab. You'll notice there is a lot of documentation. This program, ideally, will serve as a reference for future use. Once this is up and running, I may condense it to sub-vis.

One thing that would be very helpful is if LabView offered a 'zoom' function...
0 Kudos
Message 5 of 5
(2,642 Views)