I'm running a loop in windows7 which periodically polls the parallel port for a TTL signal while continuously reading samples at 1KHz for approx 1 hour. As a test, I split the incoming TTL and *also* read it as an analog signal. To my amazement, when I put the results next to each other after the test was done, i noticed that the time of the TTL and the time inside the analog data was NOT THE SAME.
more specifically, the timestamp of the TTL-up in my mainloop was 100msec *before* the timestamp in the analog data where I saw the voltage go up !
after much teeth-grinding and googling, I found that this is most likely caused by the PC clock drifting : http://www.windowstimestamp.com/description
my question is now : how can I sync this ? I have several options :
- use the library from http://www.windowstimestamp.com/description but that is quite a bit of work and will require additional DLLs to be installed
- figure out a way to use the clock of the 6221 card inside my mainloop where I poll the parallel port.
is that possible ? Is there a way to ask the time of a TaskHandle ? Or should I use the
DAQmxRegisterEveryNSamplesEvent() routine to do this ?