06-13-2012 05:11 AM
Hi all,
I'm using a PCI-6154 with LabVIEW and DAQmx to generate a 1kHz sine waveform. I've observed that the output signal frequency goes from 997 Hz to 1003 Hz as a function of the sampling frequency (48 kHz to 250 kHz). Its is probably related to the internal timebase but I don't understand exactly what happens here. Is there any way to improve that ?
By the way, the PCI-6154 is a simultaneous sampling DAQ. Do I need to turn the simultaneous sampling or is it enabled by default ?
Thanks and best regards,
Alex
06-13-2012 08:41 AM
I found that the problem was due to 20 MHz timebase frequency. It is not possible to generate a 48 kHz sampling frequency with a 20 MHz base frequency (20 MHz / 48 kHz = 416.667 => Not an integer). Closest possible frequency is 47961.63 Hz (20 MHz / 417). If a good accuracy is required, the best way is to resample the waveform to a possible sampling frequency.
This doesn't take into account any timebase drift (temperature, aging, ...).
06-14-2012 04:40 PM
I can help solve the problem you raised in the first post, but it doesn't handle the problem you raised in the second post. Why is it that you are adjusting the output sample frequency for your waveform? Is that an important feature, or is it a side effect from defining a waveform with a fixed # of samples but wanting to vary the waveform freq?
If all you really need is a way to generate very precise waveform frequencies, check out this old thread. Download one of the little utility functions there. Feed it the theoretical fraction (SampleRate / WaveformFreq) as the "Orig floating point value". It will give you a numerator / denominator pair of integers. The numerator will be the # of samples you should use to define your waveform buffer, and the denominator is the # of periods of your waveform are completed within that buffer. You'll find that it will be a virtually perfect fit.
-Kevin P
06-15-2012 03:41 AM
Hi Alex
Simultaneous sampling is always enabled. There is now way to disbable this, because its how the hardware works.
Every channel has its own ADC chip, instead of non-simultaneous devices, which have only one ADC chip for all channels.
Stefan