LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

loops

I am writing a VI that contains a while loop that provides voltage to a circuit for 5 seconds.  When the loop ends, the VI stops running and displays some voltage, current, and power measurements.  Right now I am controlling the timing of the loop by connecting the "time has elapsed" on the elapsed time block to the stop of the while loop.  Now I want to add another while loop to my VI that allows the user to imput a some values, press an "update graph" button, and create an xy graph of the data, appending the graph with each press of the button.  The problem is that right now the VI stops running after the first 5 seconds, so it will never get to the graphing loop.  Is there a way to continue to limit the first loop to 5 seconds, but not stop running the VI until after the "update graph" button is pressed?  I'm still in the process of learning LabVIEW, so a step-by-step solution would be really helpful.  Is there some example I can look at?
Thanks,
Tek
0 Kudos
Message 1 of 6
(3,020 Views)
This vi doesn't really do a whole lot by itself, but if you use it as a starting point for your program, I think you'll find it useful. 

Put some of your own code in the events, then play with the program to see what's going on.

Let us know if you need more help!
0 Kudos
Message 2 of 6
(3,018 Views)

Thank you so much.  That worked great!  I have one problem that I'm sure is not too hard to fix.  I need to get a value from the "run test" event so that I can use it in the "update graph" event.  When I try to wire the value to the frame of the structure and then wire that point on the frame to where I need it on the second event, I get an error that says something like I'm trying to wire an input into and input...or something like that:)  What am I doing wrong?  If the graphing loop is in the same event the wire works correctly, so it is not that I am trying to wire the wrong thing to the graph...it's just how I'm doing it.

-Tek

0 Kudos
Message 3 of 6
(3,002 Views)
Are you talking about wiring an input to a control?  You can't do that directly.  A control (like a boolean switch or button) is meant to be changed by the user.  To write a value to a control programatically, you can create a local variable of the control, or create a value property node of the control.  You can then write to the local variable or property node.  You may have to right click on the local or property node and select Change to Write.
- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 6
(2,993 Views)
Sorry I did not clarify.  Actually, I'm trying to wire a double to be stored in an array.  The double is calculated in the "run test" event, and the array, which provides the points for the graph, is in the "update graph" event.
-Tek
0 Kudos
Message 5 of 6
(2,987 Views)
So do you want to write the new double value to the array?  You can use the insert into array function on the array palette.  The graph needs an X and a Y coordinate, so you need two values, not one.
- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 6
(2,984 Views)