03-30-2023 04:34 PM
I am currently working on a project and could use some advice.
I currently have a NI-USB 6008 DAQ acquiring an analog signal. The sample size is currently 180 seconds worth of data before it loops. The DAQ will not write the data to the waveform graph unless the full 180 seconds pass. Is there any way to make it so that if the user ends the task early it will write the data it has acquired to the graph?
03-30-2023 05:05 PM
It is difficult to debug a "picture" (LabVIEW code, i.e. a file with the extension ".vi", is much easier for me to see and understand). I believe the problem is that you do not understand how LabVIEW, a Data Flow language, works. Pushing the Stop button on your VI won't work, pushing the "Abort Execution" button on the Menu bar will work (but then everything stops, no data saving). Do you understand why that is?
To get "better response", your code must work in smaller time units. For example, you could sample 1000 points at 1 kHz (which takes a second) and do this in a While Loop for 180 seconds, which will let you stop after completing the 1-second "inner loop" you were working on when you pushed "Stop". As a side benefit, you'd be able to few each second of data as soon as it is collected (without having to wait 3 minutes).
03-30-2023 05:13 PM
My recommendation: don't use DAQ Assistant. Use the shipping examples from Help >> Find Examples.. >> Hardware Input and Output >> DAQmx instead. See Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications to learn more.
Use Producer/Consumer Architecture in LabVIEW to pass the data from DAQmx Read VI to another loop for post-processing and logging.
03-31-2023 06:25 PM
I had the code running in 3 second segments but I may need the sample size to be anywhere from 3 seconds to a couple minutes. This meant that I was getting 40+ different excel sheets each with 3 seconds of data on them. Is there a way to code the program in a way that, when it is stopped, it exports all of the data collected into a single excel sheet?