Open etchorner opened 7 years ago
Hi @etchorner.
Speeding up the acquisition time would be a great improvement. Can you make a pull request removing the delays?
I'll see what I can do...I've only ever used Github for reposing my personal code, so I've never done a pull or proposed changes. I have a few other ideas, but I'll deal with this one first.
I'd like to suggest that the extensive use of delay() calls in the code be reduced/removed. The AD9850 is a full DDS, not a clock generator, so it does not suffer from the need to account for PLL settling time on the order of several milliseconds per change of frequency. Similarly, the delay() calls for bit-banging the serial lines to the DDS chip do not seem necessary either, based on the chip specs.
Looking at other folks research, the AD9850 settles on a new frequency somewhere around 43 ns or slightly higher, and communication time seems to be on the order of <30ns. If there is concern regarding the acquisition time through the OpAmps and the Arduino's ADC, on the order of about 1 µsec, then perhaps a delay(1) call before the analogRead() calls is suitable. Empirically, I've removed all delay() calls from my local code and the output data remains coherent and in line with the delay()'d code outputs, it just runs a scan in less than 1 second as opposed to 12 seconds.