Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

USB 6008 Analog-Digital synchronisation in ANSI C

Solved!
Go to solution

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

0 Kudos
Message 1 of 4
(3,280 Views)

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 youSmiley Wink without missing a scan clock cycle.


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 4
(3,277 Views)

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.

0 Kudos
Message 3 of 4
(3,267 Views)
Solution
Accepted by willemf

A more sophisticated device.  the 6008 DIO can only be softwre timed and does not support and triggering or hardware timing.


"Should be" isn't "Is" -Jay
Message 4 of 4
(3,257 Views)