Hi, I want to reduce the prescaler factor so that my Arduino Due takes less time for executing a command (analogRead() ). I had seen some sample codes for setting the prescaler in other Arduino boards, they use the ADCSRA register for doing that. But when I search in the datasheet of Arduino Due Atmega, that register does not exist.
So my question is : Is it possible to set the prescaler factor in Arduino Due ? And if yes, can someone help me with a simple code.
That's not appropriate to the Due, which has a completely different architecture.
The chips already setup at the maximum clockspeed it supports.
If you want faster than the existing analogRead() you'll need to setup
times and DMA or interrupts to trigger conversions and store the results,
a minimum of 3 hours reading the datasheet (!)
Is it the same for every Arduino Due ? (If there are several arduino Due members. I don't know).
If it's 2us for an analogRead(), then it's perfect for me. But I had read some posts which say Due takes about 39us for an analogRead() in default setting. If I want to make it shorter, I can change something in the master clock MCLK.
Hi this is an example of cide that I wrote in order to make ADC read faster
ADC->ADC_WPMR = 0x00;//Disables the write protect key, WPEN
ADC->ADC_MR = 0x00000000;//clear all the before setted characteristics of ADC
// set ADC prescaler to 8
bitSet(ADC->ADC_MR,8);
bitSet(ADC->ADC_MR,9);
ADC->ADC_CHDR |=0xC300;//disable channel 15,14,9,8 (not connected on Arduino Due)
ADC->ADC_CHER |=0x3CFF;//enable remaining channel
ADC->ADC_CGR |=gain2register;//set ADC gain
delay(1000);//delay of 1 s for stability
Serial.println(ADC->ADC_CGR); //I have to see the current gain, for debug
Serial.println(ADC->ADC_CHSR); //I have to see 15615, for debug
ADC->ADC_CR = 2; //start conversion
Hi
Please explain which number is exactly the prescale number?
Is the system clock divided by 8،9،11?
Do not need to be binary? Or ASCII Code?
What is the (->)
Where exactly is the prescale register location? Namely, in the ADC-Mode Register, you should immediately enter the Prescale value?
And I want to see the adc clock number after the split on my serial monitor,Can the place be read from the registry? What is its name?
(ADC->ADC_CR = 2; //start conversion) what is the 2 ?number of channel ?
Please guide me this is my email Sadoo2010@gmail.com
I'm doing something that may helps others.
Thank you.