10-14-2017 04:42 PM
Hi all,
I'm trying to use the matlab NI daq toolbox to send a predefined vector of TTL pulses (350 hz, 50% duty cycle) out of a USB-6212 DAQ analog out port. I am able to set the output rate accurately at 1khz, 10khz, etc.; however, these sampling rates can't accommodate accurate 350 hz signals at my specifications. I tried changing the rate to 35khz, it seems like system can't sample at that exact frequency, rather at 35026.2697 scans/second. Is there any way to work around this in with the daq and matlab?
Thanks!
Charles
10-15-2017 02:23 PM
At a hardware level, you can only generate frequencies that are an integer divisor of the timebase. The fastest timebase on an M-series board is 80 MHz. When aiming for 350 Hz, the theoretical divisor would *want* to be 228571.43 But what it'll *have* to be is either 228571 or 228572. (I'm not certain whether the rounding algorithm rounds up, down, or nearest). Nominally, you'll be able to produce either 350.00066 Hz or 349.99913 Hz
The (mostly) good news is that you're getting a rounding error that's in the order of less than 5 parts per million. That's pretty small, especially considering that the absolute accuracy specs on many MIO boards' timebases is more like 50 parts per million.
I don't know whether the Matlab toolbox induces any further restrictions. The quantization in your attempt to produce 35 kHz suggests it might restrict you to the 20 MHz timebase.
-Kevin P