LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Generating Sine Wave with NI-USB 6212

Hello,

 

I'm trying to generate a continuous 40KHz sine wave, using NI-USB 6212.

 

Based on the code from a CVI example: "Cont Gen Volt Wfm-Int Clk",
I changed the size of the write array to 32 and the Sample Rate to 1M.

As I understood, the frequency of the output signal is the ratio between Sample Rate and number of samples written (array size).

This resulted a sine wave at ~31.3KHz, which is the maximum frequency I'd managed to generate.

Trying to reduce array size or to increase sample rate, produces the following error:

"Decrease the output frequency to increase the period between DAC conversions, or reduce the size of your output buffer in order to write data more often. If you are using an external clock, check your signal for the presence of noise or glitches.
Status Code: -200018"

 

Is it a hardware limit? What is the maximum frequency that can be generated with this hardware?

Is there a software solution for this? Or perhaps additional configuration should be applied?

 

Thank you

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

If you want to generate a 40khz sine wave and use 1M samples/sec then, you can have 25 samples per period.

Just make sure you create a single period array of 25 samples, or 2 period array of 50 samples, or 3 period array of 75 samples, etc...

I would advise to make the array a little big, like 1000 samples (40 periods) otherwise your pc will get to much interrupts to transfer the data and that may slow your pc down.

If you generate a sine pattern array of 1000 samples (which has 40 full periods inside) and update the output with 1Mhz, you'll see a 40khz sine at the output. 

S. Eren BALCI
IMESTEK
0 Kudos
Message 2 of 2
(1,667 Views)