ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make chart from multiple loops without local variables

Hi,

 

It is my first experience in LabView.

 

I did a program that communicate with Power Supply Device via RS232, sets an output voltage and read Voltage and Current in some sort of a program: Voltage goes up, staying in some value and then goes down. So there are many FOR LOOPS that sequensed one after another.

 

I need to make a 2 live Charts (one for current and second for voltage), and the only one solution that i could obtain is using local variables. BUT also I need to export my data to the file after the end of the program (with real elapsed time for collecting data points) and with the use of local variables I cannot do so. Maybe the Shift Register will work, but I could not make it work.

 

 

Thank you for help.

0 Kudos
Message 1 of 3
(2,965 Views)
I can't look at your Vi since I am posting by phone but I don't understand the need for multiple for loops and why you cannot read both voltage and current in a single loop. When data exits a for loop, it automatically creates an array so you should have your timestamps and data readily available for a file write. You could also do a write as soon as you acquire the data.
0 Kudos
Message 2 of 3
(2,949 Views)

You have multiple, deeply stacked, sequential loops. Way too complicated.

 

All you need is a simple state machine architecture using a single loop and a single instance of your charts. No local variables needed. Simplify!!! You could even graph both values on a single chart.

 

Look at your code. It is basically repeating the same thing with slighly different inputs. You only need to change the inputs based on state, and re-use the same IO function instances. Only one instance each needed.

 

(you also have some misguided autoindexing near the middle of your code. Bad!)

0 Kudos
Message 3 of 3
(2,939 Views)