09-10-2010 01:33 PM
I am trying to control the timing of an output signal that is turned on and off in a while loop I have created. I am using Labview 8.0 on a PXI-8176 with outputs and inputs coming through a PXI-6052E. The issue I am having is that the timing occasionally appears to be off and the pulses I am sending out are occasionally either too long or aren't outputted. I think I have tracked the problem to the timing of my while loop. I can't seem to figure out how to fix the time step of my loop. Some iterations seem to execute faster than other. If it takes extra time for the loop to turn on or off the signal, it is a problem. How do I fix the time step of my loop (let's say to 50Hz). Thanks.
-Michael
09-10-2010 03:27 PM
You are doing software-timed loops. There's a few things you can do, but ultimately you will be at the mercy of the operating sytem unless you use a real-time operating system or use hardware-based waveform generation. The card you have should be capable of that, so I'm not sure why you're not generating the output that way. Have you looked at the examples that are installed with DAQmx on how to do hardware-timed analog output?
09-10-2010 03:29 PM
A non real time OS, like Windows, has some overhead that will always affect speed of execution. You will not be able to get a consistent loop time unless you switch to a real time OS. The Timed Loop comes close, but it is only accurate to about 1mS. With a real time OS, it is accurate to 1uS.
Now if you time your output with hardware, that is different. You should be able to get much better accuracy by using hardware timing (on board clock of a HSDIO). Tell us more about what you want and attach your code. If you want to generate a pulse train, it is better to do it with hardware rather than a loop that toggles the bit and sends out the data.