Multifunction DAQ

cancel
Showing results for
Did you mean:

How to calculate the optimal Sinewave?

(Duplicated from https://lavag.org/topic/19098-how-to-calculate-the-optimal-sinewave/)

How do we calculate the optimal Sine wave waveform on a NI-6723?

What is the best settings to generate a clean sine wave with the NI-6723?

According to the specs it can do 800KS/s (45KSamplings/second per channel). I'm using 8 AO channels.

What would be the best settings for the Waveform Buffer Generation and for the DAQmx Timing (Sample Clock)?

Do I need to add a Regen?

Other information:

When I set the Resulting Sample Clock Rate to 450000, the card gives no issues and generates a somewhat clean sine wave, with the exception of spikes when the sine wave crosses 0 (Glitch Energy of the NI-6723, scoping it does show it is as per specs of 2us for 400mv, this will be problematic when my lowest amplitude is 450mV...).

I inherited a code and need to clean up the sine waves generated by the NI-6723 at 45KS/s for 3KHz with a forced samples per buffer at 750:

When I set Sampling Rate at 450KS/s

This was the code that generated the sine wave (20 instead of 2 and the disable was enabled).

The code I inherited is at least 100 monitors square with a lot of loops and flat sequences, so I'm not sure if I can accelerate the loop (it is not running on a RT, so I assume it can be changed to a normal loop with a Wait for Next). I'm testing the code in a test vi.

Thanks

Message 1 of 2
(3,498 Views)

Re: How to calculate the optimal Sinewave?

Stumbled onto this posting far too late to help the original poster, but for the sake of other future stumblers, I have a nifty solution for the timing part of the problem, i.e., fitting an exact integer # of sine cycles into a regeneration buffer with discrete available sample rates.  This should address the glitch energy at zero-crossings.  It doesn't address the amplitude purity at all, that'll still be subject to the normal D/A quantization effects.

Without further ado, I send you to this thread.  In retrospect, it's a little dense to read, but all the needed info is there if you stick with it carefully.  Plus there's example code at the end to try out.

Recapping, the essential idea is to do some iterative math that takes into account both the exact desired sine wave frequency and the exact discrete sample rates available.  It finds the closest matches that let you define a regeneration buffer containing a pretty much exact integer # of sine wave cycles. The example program lets you see how close to exact you get when allowing successively larger buffer sizes.

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW?

(Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).

Message 2 of 2
(2,337 Views)