I'm using DAQmx 8.0, with a 6011 "E" series board, VC++. The application: Trigger a series of single channel AI reads (to get an average) on an encoder pulse, and continuously count the encoder pulses. The goal is to end up with an array of voltages and encoder counts, so I know what the average voltage was at each encoder pulse. The encoder is maxed out at about 600Hz. I can't miss any encoder pulses.
The "simple" approach does not seem to be fast enough. "Simple" meaning:
1) Set up edge triggered counter and Analog In with external digital trigger (both triggers are PFI3)
2) START counter task, COMMIT analog task
3) Loop:
start analog task
read analog value
read counter value
stop analog task
print analog and counter value to console window
4) end
I have to slow down the encoder to about 300Hz to stop missing encoder pulses.
The retriggerable counter method will not work either since that uses two counters, and therefore I loose my ability to continuously count encoder pulses.
It just hit me that printing to the console window won't be happening in the real application, but the printing overhead might not be too different than the overhead due to averaging the analog samples and stuffing everything into the final array.
Am I missing something in my approach? Is there a (better) way to do this with my hardware?
Thanks,
Jim
I previously posted this question in the MS VC++ group. Sorry for the confusion.