Hello,
Now that I have good enough slow measurements with my DUE ADC, I want to measure fast.
There are lots of topics and webs about this, like this one: http://www.cloud-rocket.com/2014/07/arduino-due-sam3x8e-information-developers/
but I dont understand most of the stuff they say or use.
I want to measure really fast for a short period of time on two analog inputs: A0 and A1 (they can be changed if necessary), and I want to do it at the same time.
I want to measure fast, but I dont really need to reach 1mhz (from what I read you need DMA). I need to measure fast but also accurate and stable.
The code I use right now is like this:
for (int k = 0; k<tamCurva;k++){
if(k == 1){
digitalWrite(pinmedida, LOW);
}
analogReadResolution(12);
curvaV[k] = analogRead(vpin);
curvaI[k] = analogRead(ipin);
delayMicroseconds(msdelay);
}
As you can see I put the values on two different arrays and use a delay of theoretically 3microseconds.
From what I read on webs like this one: Loading...
my measurements are not really taking 3us because of limitations of the due.
How can I know if I'm measuring with that delay truly?
If I add at the begining of the code this lines that the webpage says, Will I measure at 3us?
REG_ADC_MR = (REG_ADC_MR & 0xFFF0FFFF) | 0x00020000;
REG_ADC_MR = (REG_ADC_MR & 0xFFFFFF0F) | 0x00000080; //enable FREERUN mode
analogReadResolution(12);
If not, what should I do? Can someone help me get a code for this?
Thanks