12-14-2017 11:10 AM
Hello,
I'm trying to use NI USB-6211 DAQ's 2 AO channels to run simultaneous sawtooth waves. AO0 to run continuous sawtooth at 40000 Hz, with 1024 sample. AO1 to run one cycle of sawtooth at 40Hz, with 512 sample. I use sample clock as a trigger pulse to camera which has to sync with AO0's sample rate.
When I run my code, AO0 works fine (sawtooth, static move, all works) but AO1 doesn't work. Can anyone suggest what I'm doing wrong?
Thank you.
Solved! Go to Solution.
12-14-2017 02:34 PM
Yeah, you need to construct your code so that both AO channels are part of the *same* hardware-timed task. There's only one timing engine available for the AO subsystem on the board, so multiple channels need to be part of the same task.
As a consequence, you'll probably end up running at 40 kHz. You'll need to carefully plan out your 2 AO channels as a 2D matrix of values. Since this *sounds like* some kind of raster scanning app, you'll probably have AO0 vary at every sample while AO1 will probably repeat the same value for 1000 (or maybe 1024?) samples, then change once and repeat again.
-Kevin P
12-14-2017 07:35 PM
Hi Kevin,
You are exactly right, this is a scanning program that I need to run AO0 continuous sawtooth at 40KHz and AO1 run one sawtooth cycle at 40Hz then stay at 0. It sounds like I won't be able to do this running one channel continuously and the other channel run one cycle....
12-15-2017 02:59 PM
Right, both channels need to be in the same task and you need to define sample data for both channels at the fast (40 kHz) rate.
It's not so bad though, not really. AO0 wants to repeat a sawtooth of 1024 samples. (Or maybe it'll sweep in reverse on alternate lines?). AO1 wants to make a slower sawtooth of 512 samples. All together you've got 1024*512 samples per channel for your 2 channels. Not a big deal.
Attached is an example vi to generate a 2D array of AO0 and AO1 data. There's an option to have AO0 sweep in reverse on alternate lines. You can feed this 2D array of data to a finite AO task set to generate 1024*512 samples.
-Kevin P