05-17-2025 09:58 AM
Hi all,
I’m running into trouble with a LabVIEW project that involves handling a lot of data for analog output. I’d appreciate any advice on these two points:
1. **Generating Large Waveform Data:**
I need to create a long, complex waveform (for example, a sine sweep from 18 Hz to 30 kHz over 2 minutes). Because of the high sampling rate and long time, this results in a huge amount of data, and I’m running into memory issues when trying to generate the whole signal at once.
2. **Sending Data to DAQmx Analog Output:**
After generating the data, I need to send it out through DAQmx analog output. I’m not sure how to do this efficiently without running into memory problems, since sending all the data at once isn’t working.
Has anyone dealt with similar issues or found good strategies for generating and outputting large signals like this? Tips on chunking, streaming, or any other best practices would be really helpful!
Thanks in advance!
Solved! Go to Solution.
05-17-2025 04:09 PM
05-17-2025 04:27 PM
Thanks for the suggestion!
Could you share the best way to write data in chunks to DAQmx for analog output so that the output remains smooth and free of glitches when moving from one chunk to the next?
05-17-2025 07:41 PM
Don't have LabVIEW available, so try to explain, ... Load about 10s of waveform, then in 8 or 9s, load the next 10s, etc. You can use a loop with a Wait or stall Data flow to accomplish this.
05-18-2025 12:16 AM - edited 05-18-2025 12:21 AM
Try this Sound and Vibration Toolkit Example:
Audio Measurements\Discrete Swept-Sine Measurements (DAQmx).vi
The example computes and generates the output signal in chunks. At each discrete frequency, the example also processes the acquired input signals.
05-20-2025 06:37 AM
Can anyone help me understand how to write a long waveform to a DAQmx analog output (AO) in chunks? I was able to do this, but I get glitches between chunks because there is a waiting time to write to the buffer+processing time.
05-20-2025 09:07 AM
Here is an example that writes (gap-free) to DAQmx AO in chunks:
2020 version attached.
05-20-2025 10:11 AM
Fantastic. I see you use continuous samples, while I was using finite samples. The wait inside the while loop is really necessary?
05-20-2025 10:17 AM
The Wait inside the while loop is only necessary on certain types of hardware (such as ethernet cDAQ) where the driver allows additional data to be written to the buffer faster than the hardware pulls from the buffer.
05-21-2025 10:11 AM
@luisdclopes2 wrote:
Hi all,
I’m running into trouble with a LabVIEW project that involves handling a lot of data for analog output. I’d appreciate any advice on these two points:
1. **Generating Large Waveform Data:**
I need to create a long, complex waveform (for example, a sine sweep from 18 Hz to 30 kHz over 2 minutes). Because of the high sampling rate and long time, this results in a huge amount of data, and I’m running into memory issues when trying to generate the whole signal at once.
2. **Sending Data to DAQmx Analog Output:**
After generating the data, I need to send it out through DAQmx analog output. I’m not sure how to do this efficiently without running into memory problems, since sending all the data at once isn’t working.
Has anyone dealt with similar issues or found good strategies for generating and outputting large signals like this? Tips on chunking, streaming, or any other best practices would be really helpful!
Thanks in advance!
The following might be useful in case you want to output a frequency sweep and want to measure signals coming back from your setup / experiment through a single USB DAQmx-device:
Sample rates in the example given above are rather low (51200 samples / s). If you need much higher sample rates for generating (outputing) and simultaneously reading signals you can also use several (shorter lasting) sweeps. Depending on hardware***, each sweep can be done glitchles at several 100kHz sample rates through USB, simultaneously, on a single device.
[***we are using the USB-6351]
The secret is that you only do minimal uploading to generate your (Output) sweeps so your full focus can be on reading the various (Input) signals coming back from the DAQ-device. This is assuming the signal to output has a fixed pattern, like a sine wave or similar.
Failing clear documentation by NI you might have discovered that uploading a fixed set of samples into the output-buffer of your DAQ only allows for rather crude frequency increments during a frequency sweep. This is caused by NI using an internal clock as a base. All your samples will be output with precise integer defined delays between each sample based on that clock. There is no internal sine signal generator or any interpolation system to gradualy change the outputed frequency based on your fixed set of samples. (At least none that I have discovered.)
By chosing some convenient sample sets for your sweeps (like a 500, 501, 504, and 496 sample representation of a single sine-wave) you can upload a set and than use those samples for a sweep. Combining the results of all those sweeps could then give a reasonable set of measurements at various frequencies. (the specific case needed a sweep from around 750Hz to 1kHz)
The frequencies you can do with "fixed sample set" sweeps are based on the internal NI clock (in my case 100MHz) and using various integer "delays between samples". You just continuously output the fixed samples and vary the "SampClk.Rate" when you want to change the frequency. If you keep the changes to "SampClk.Rate" small the signal transition will be relatively smooth (without glitches). By using less output-samples in your fixed sample sets the frequency steps per sweep become smaller.
To create such a solution yourself is a lot of work. But with some care the USB-6351 can then flawlessly read several (in my case 3) inputs at 250kHz continuously, during a few dozen seconds.