Hi everyone!
I'm completely new of both the forum and the Arduino world. I looked around and I could not find a satisfactory answer to my question. I hope I didn't miss anything important.
I literally started working on a concrete project today. The objective is using an Arduino DUE board to lock an optical cavity. However, for the moment I'm just doing some tests to check whether I like this board or not considering the scope and practicing a little with it.
Currently, I'm supplying a signal to one of the analog pin, passing it to the DAC, and reading its output on the oscilloscope. As an input signal, I'm using a sine wave, 3 Vpp with 1.5 V offset DC so to have it completely positive. As for the frequency, I tried from 100 Hz to 10 kHz. On the high-frequency side, I notice that the output from the DAC is kind of steppy, with each step being ⁓ 10 μs wide. I guess this is because either the reading or writing commands, or both, work on that time scale. Is there any way to improve it?
Here is the code I'm using (very simple, just read and write)
void setup() {
pinMode(A0, INPUT);
pinMode(DAC1, OUTPUT);
analogWriteResolution(12);
analogReadResolution(12);
}
int i;
void loop() {
// Reproduces the signal read from A0:
i = analogRead(A0);
analogWrite(DAC1, i);
}
Thanks for any answer!