04-22-2019 04:29 PM
If your accuracy is only +/- 10% and you're sampling at 250 kS/s, yeah, you might be right at the boundary of being able to reliably get a point at each crest and trough at each frequency. Imagine a sine at an arbitrary frequency, and draw dots on either side of one crest. Let each of those be 5% less than the positive amplitude of the sine. (5% on either end yields 10% total.) This would be the worst-case position for the sample clock to fall. I would do the trigonometry to find out what the actual spacing is between these two points for a 16 kHz sine wave. That will roughly determine the minimum sampling rate you should be using to theoretically be able to always capture an amplitude within 10% of the true amplitude at any frequency. If it's more than 250 kS/s, you're going to have a rough time using the 6211. I would get a device capable of sampling at your minimum rate.
04-22-2019 10:24 PM
A couple further thoughts:
1. Instead of trying to sync AO and AI with an exported trigger signal, try syncing with an exported sample clock.
2. Once AI is driven by the AO sample clock, then the same AO value is present to be sampled by all channels in the AI task. The multiplexing issue kinda goes away because the AO signal is (theoretically) held constant between samples. All AI channels should see the same value. (Note: you'll need to be sure that AI uses the same rising/falling edge polarity as AO).
My guess is that feeding the AI channels from AO is just a little proof of concept before measuring a real-world signal. So I'll move on to some further comments related to *that*, building on a couple excellent posts from croohcifer.
Consider a normalized sine wave with amplitude = 1.0. If you push the limits, you want to be sure to sample at a phase where the amplitude is *at least* 0.9. So we calculate arcsin(0.9) ~= 64.16 deg. Since peak amplitude is at 90 deg, you need to sample fast enough that one of the samples is going to be within 25.86 deg of 90. Worst case is to sample exactly 25.86 deg on either side of 90 for a total of sampling every 51.72 deg.
This corresponds pretty closely to 7x oversampling as an absolute bare minimum to ensure that you always sample at a time within 10% of the min and max of the sine wave. To capture amplitude of a 16 kHz sine with no more than 10% amplitude error, you must sample at no less than 7*16 = 112 kHz.
So you're cutting it awfully close with a 125 kHz sample rate. There's almost no margin for any other source of measurement error.
-Kevin P