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: 

Record a signal for arbitrary amount of time?

Hi all,

 

I have a small circuit that acts as a "piano" (different voltages are sent into a small 8 ohm speaker, which then plays the signal). 

 

My problem that I've been working on is that I would like to record the voltages that are being sent through the speaker for some arbitrary amount of time -- until the user presses a button on the front panel. To do this, I've thrown a DAQ express VI inside of a while loop, and have set the VI to "1 sample on demand" -- every iteration of the loop, the DAQ picks up 1 sample, and appends it to an array. This repeats every iteration of the loop (the stop condition of the loop is set by a . 

 

However, the loop doesn't appear to iterate fast enough (the signal comes out very messy). Continuous sampling would appear to be better, but I'm not sure how to do this for some arbitrary amount of time, until a button is pressed. I would appreciate any suggestions on how to accomplish this.

 

Once the "stop" button is pressed I'd ideally have an array of doubles containing all the voltages recorded, which I can then go on to manipulate...

 

Sorry if this is a very easy question -- I'm super new to LabView!

0 Kudos
Message 1 of 2
(2,089 Views)

1.  You definitely want the continuous sampling.

2. You really should not be appending data to an array.  That gets memory intensive to constantly reallocate arrays each iteration.  Instead, use a Producer/Consumer to use another loop to stream the data to a file.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 2
(2,058 Views)