torekp Posted August 4, 2009 Report Share Posted August 4, 2009 This NI document says Problem: Why do I have to specify a rate when using an external Sample Clock? Solution: NI-DAQmx uses the rate input to calculate the buffer size for the task. If you want to specify a particular buffer size, use the DAQmx Configure Input Buffer VI or the DAQmx Configure Output Buffer VI. The rate input of the Sample Clock VI is also used to calculate the dt component of the waveform data gathered by calling DAQmx Read. By modifying the rate input you will see the data being displayed differently each time due to the dt being changed with each different rate input. As noted in the documentation for the DAQmx Timing VI, it is recommended to have the rate set for the maximum expected rate of the external clock. But that's not the whole truth: it leaves out the most vital fact. I have an Analog Output and Analog Input task which share an external sample clock. The external clock comes from a belt encoder and averages 125 kHz with small fluctuations around +/- 1 kHz. The external clock line also drives another process on another computer, which I can use as a check on my process. When my process is working properly, it will stay in sync with the other computer. When I set the "rate input" to 147 kHz (which used to be accurate, but things have changed since then) my process goes out of sync by a very small amount. My process "sees" only about 99.8 percent of the clock pulses; or at least, that's how much it falls behind. When I set it to 125 kHz, the actual rate, it does not go out of sync, or perhaps it does but in a much more subtle way. (I would have to run an eight-hour test to be sure it does not go out of sync enough to matter.) Has anyone else noticed this phenomenon? How close to the truth does my rate input have to be, to avoid this problem? Or am I just doomed? I'm using a PCI-6110 board for AI and PCI-6733 for AO. I wonder if this NI document contains the seed of an answer to my issue. Problem: I am trying to generate a square wave of 10682 Hz with an update rate of 800 kS/s on the PCI-6733. Why does the frequency of the output signal oscillate? Why am I not getting a stable frequency output? Solution: The output frequency is not stable because the PCI-6733 can only generate discrete frequency values for a given update rate. These set of discrete values are obtained by dividing the update rate by a integer value. For example, if you have an update rate of 800 kS/s, the PCI-6733 can generate 10810 Hz and 10667 Hz with an accuracy of 1 Hz. These two values are obtained by dividing 800 kS/s by 74 and 75, respectively. If you try to generate 10682 Hz, the 2 closest levels to this value are 10810 Hz and 10667 Hz, so the output oscillates between these two values. Maybe NI is like the X-files: the truth is out there, but good luck finding it? Quote Link to comment
torekp Posted August 4, 2009 Author Report Share Posted August 4, 2009 Further testing shows that a simplified version of my VI runs just fine regardless of the specified rate. Now I am really confused. Quote Link to comment
torekp Posted August 4, 2009 Author Report Share Posted August 4, 2009 Further further testing shows that the problem is probably the other computer, not Labview or the NI hardware. My bad! Quote Link to comment
JustinThomas Posted August 5, 2009 Report Share Posted August 5, 2009 As far as I can remember in DAQmx the rate specified helps the DAQmx driver to set the buffer size for your task. As such it should not matter if the rate specified is not exactly the rate of the external clock. Just my two cents Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.