From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquire data, buffer data in the chart, have the option save data file

 

Hello, 

 

I am very new to Labview.  I have a situation where I click a start test button to run the program and acquire data from AI (voltage and time) into a chart.  Monitor and continue graph into a chart and the program stop automatically when it reached 300 seconds.  Make sure the graph look ok, click a save button and it will save the 300 data points represent 300 seconds run.  If data on the graph is not valid, then click a button to re-run test.

 

Please help. 

 

Does anyone know what is the best way to start programming this case that.

 Do use pararallel while loops? 

Use For Loop to buffer data before click Save Button.

Producer and Consumer loops?

 

 

0 Kudos
Message 1 of 3
(2,754 Views)

Hi Marlin,

 

It sound like you have done some research and realize that using a state machine will be the way to go. 

 

You will need an Idle sate as the default, where you sit and loop until you get a user input to start the data acquisition. 

 

Then you will want to transition to a Data Acquisition state where you actually acquire the data.  You didn't mention what hardware you are using, but if it is one of our DAQ cards I would suggest taking a look at the DAQmx example finder examples.  You could either use a continuous acquire and graph example while programmatically checking to see if 300 seconds have passed (like the Elapsed Time) at 1Hz, or just acquire N samples (300 in this case) at the rate you need.


I'm not sure exactly what you mean by 'Make sure the graph looks ok', but the next step would probably be some sort of data analysis state, where you would either write the data to a file or return to the Idle state.

 

I don't think that you will need to use any producer/consumer loops or anything special at all with a test running this slowly.

 

Just read up, look through as many examples as you can, and good luck.

 

Justin Parker
National Instruments
Product Support Engineer
0 Kudos
Message 2 of 3
(2,735 Views)

Few questions:

1: How do you want to save the data? Excel, Word, Notepad, PDF...
2: Can the program know that the data is invalid or not?
3: How is the data being gathered? USB? GPIO?
Structure wise: you can just have a Case Structure inside of a while loop. You may not have to worry about the graph being invalid because you choose to save the data anyways. Just have the outside boolean be the run test boolean. Use a milliseconds timer for short test runs like yours. Use a Waveform chart to display the data.

Let me know if you need anymore help.

CLD Certified 2014
0 Kudos
Message 3 of 3
(2,733 Views)