08-26-2007 01:54 PM
08-28-2007 10:57 AM - edited 08-28-2007 10:57 AM
The error -200301 occurs because you’re trying to change an
attribute of the clock output before it has completed at least one cycle.
For example, I used the Gen Dig Pulse Train-Continuous.vi (Help » Find Examples
» Hardware Input and Output » DAQmx » Generating Digital Pulses) and modified
it slightly as shown below. I tested the example with quite a few
variations of numbers on two different computers all with the duty cycle at
0.5. It appears that at frequencies greater than 1 KHz I was able to set
a wait until next ms multiple to 1ms and never saw the error on either
machine. When I reduced the frequency and left the wait at 1ms, I was
able to go as low as 32 Hz without seeing the error on one machine and only
48Hz on the other. This just shows that the exact minimum timing is
system speed dependent. In
regards to how to avoid this error, I would first use a wait until next ms
multiple in the while loop of your counter generation. As long as the calculations and processes made
within the while loop take less time than the wait you set, the while loop
iteration will wait for x ms regardless of those other execution times.
This allows you to have better control over the rate of your while loop.
I would also recommend keeping your wait to at least 1 period of your
frequency. If you’re generating a 1 KHz signal, keep the wait greater
than 1ms.
Message Edited by Paul C. on 08-28-2007 10:58 AM