12-27-2011 01:58 PM
I need to read four analog channels and two digital channels of a USB 6008 more or less simmultaneously at a rate of 2 Hz (500 ms time interval). I use NIDAQmx and ANSI C on WinXP and VisualC++ 2010 Express. There are two problems in ANSI C:
1) Implementing a software timer. The System32 timers are not reported to be accurate below above 1Hz, taking into account the whims of WinXP.
2) Achieving synchronisation between the two types of input channels is not simple. The built-in example code given with NIDAQmx (contAI-ReadDigChan) is apparently not meant for the 6008.
Does anyone perhaps have any example code in C/C++ that solve one or both of the above challenges?
Thank you in advance for your time,
willemf
Solved! Go to Solution.
12-27-2011 02:46 PM - edited 12-27-2011 02:51 PM
Actually the system timer is good to mSec resolution but may have up to 10mSec of jitter- not the limiting factor in your app! The 6008 DIO is software timed only- to get any kind of syncronization between a AI and a DI task you need hardware timed DIO. However at the 500msec period you are looking at a simple AI read followed immediatly by a DI read in a loop should provide a relatively consistant timing relationship between the reads. On the other hand- why not take the DI channels over to some unused AI channels? a simple >2.5 comparison with convert them to "digital" for you without missing a scan clock cycle.
12-28-2011 12:18 AM
Thanks for the reply, Jeff. I actually use four differential analog inputs but, come to think of it they do not need to be differential any more. Sounds like a good plan not to use the DI part of the 6008. A short question. When you talk about 'hardware timed DIO', did you have in mind an external clock applied to the PFI0 terminal of the 6008, or a more sophisticated NI device? Kind regards, Willem.
12-28-2011 11:48 AM
A more sophisticated device. the 6008 DIO can only be softwre timed and does not support and triggering or hardware timing.