how to increase the sampling rate and reduce the adc conversion time

Hi,

In this link Fast Analog Input you will a post by mantoui that give some code that increases the analog sampling rate.

or I also found this on some website someplace.

void AdcBooster()
{
    ADC->CTRLA.bit.ENABLE = 0;                       // Disable ADC
    while( ADC->STATUS.bit.SYNCBUSY == 1 );           // Wait for synchronization
    ADC->CTRLB.reg = ADC_CTRLB_PRESCALER_DIV64 |      // Divide Clock by 64.
        ADC_CTRLB_RESSEL_12BIT;                      // Result on 12 bits
    ADC->AVGCTRL.reg = ADC_AVGCTRL_SAMPLENUM_1 |      // 1 sample
        ADC_AVGCTRL_ADJRES(0x00ul);                  // Adjusting result by 0
    ADC->SAMPCTRL.reg = 0x00;                         // Sampling Time Length = 0
    ADC->CTRLA.bit.ENABLE = 1;                        // Enable ADC
    while( ADC->STATUS.bit.SYNCBUSY == 1 );           // Wait for synchronization
} // AdcBooster


int analogPin = 1;

unsigned long start_times[100];
unsigned long stop_times[100];
unsigned long values[100];


void setup() {
   AdcBooster();                                     //uncomment for reading time without 'boost' 
 
   Serial.begin(9600);
   pinMode(analogPin, INPUT);
}

void loop() {
    analogReadResolution(12);                      //analog resolution to 12bit 
    unsigned int i;

    for(i=0;i<100;i++) {
        start_times[i] = micros();
        values[i] = analogRead(analogPin);
        stop_times[i] = micros();
    }

    // print out the results
    Serial.println("\n\n--- Results ---"); 
    for(i=0;i<100;i++) {
        Serial.print(values[i]);
        Serial.print(" elapse = ");
        Serial.print(stop_times[i] - start_times[i]);
        Serial.print(" us\n");
    }
}

Luc