11-10-2015 10:42 AM
I’m having some trouble collecting points from the encoder on a USB 6221 board on Windows 7 x64 using NI-DAQmx 9.3.0. Here is a little bit of the background on what we’re doing. Our application creates a single encoder task and keeps it alive for the duration of the application. We do this in order to preserve the counter value because stopping and creating a new tasks causes the encoder counter to be reset back to zero. Whenever the application is sitting idle, we sample the encoder at 200 Hz in order to present a “live” display. Whenever we are ready to sample the encoder to collect a waveform, we do a little magic to clear out any potential stale values in the buffer and provide a new clock at the desired sampling speed.
This all worked well on Win XP using NI-DAQmx 8.9.0, but now on Win 7 the first few points we collect when calling DAQmxReadCounterU32 appear to be sampled at the old clock speed. It’s very random in nature, which leads me to believe it’s a timing issue.
Since nothing has changed on our end except the OS and the NI API version, I’m not entirely sure how to tackle this problem.
Any suggestions?
11-11-2015 03:55 PM
David,
How are you switching clocks? It's possible that the new software runs a little faster which has exposed a race condition in your code. You can try putting a Wait(ms) VI before starting to collect your waveform data, but after switching the clocks. Would it be possible to try this?
Thanks,
aprillest