Show Posts
Pages: [1]
1  Using Arduino / Interfacing w/ Software on the Computer / How to increase sampling rate on 16 channel ADC of Arduino1280 on: February 10, 2011, 01:39:31 am
I'm new for Arduino and I'm sorry if i posted wrong topic in this spot.

I have a problem on my project that is I want to use all 16 channels on ADC of Arduino 1280. Each channel should received around 1,000 sampling rate for sending to serial port interfacing with computer.

I also use the prescale but it's still not good sampling rate. I got maximum sampling rate with these 16 channels on 10 bit around 120 sampling rate on each channel that's far from my goal (1,000 sampling rate on each channel).

How do I increase my sampling rate without decreasing the number of bit(I want to use 10 bit). This model can do that?

This is my code.

--------------------------------------------------------------------
#define FASTADC 1

// defines for setting and clearing register bits
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif

void setup() {
  #if FASTADC
  // set prescale to 16
  sbi(ADCSRA,ADPS2) ;
  cbi(ADCSRA,ADPS1) ;
  cbi(ADCSRA,ADPS0) ;
  #endif
  Serial.begin(115200);
}

void loop() {
  Serial.print("time = ");Serial.print(millis());
  Serial.print(",  ");
  Serial.print(analogRead(A0));Serial.print("  ");
  Serial.print(analogRead(A1));Serial.print("  ");
  Serial.print(analogRead(A2));Serial.print("  ");
  Serial.print(analogRead(A3));Serial.print("  ");
  Serial.print(analogRead(A4));Serial.print("  ");
  Serial.print(analogRead(A5));Serial.print("  ");
  Serial.print(analogRead(A6));Serial.print("  ");
    Serial.print(analogRead(A7));Serial.print("  ");
    Serial.print(analogRead(A8));Serial.print("  ");
    Serial.print(analogRead(A9));Serial.print("  ");
    Serial.print(analogRead(A10));Serial.print("  ");
    Serial.print(analogRead(A11));Serial.print("  ");
    Serial.print(analogRead(A12));Serial.print("  ");
    Serial.print(analogRead(A13));Serial.print("  ");
    Serial.print(analogRead(A14));Serial.print("  ");
  Serial.println(analogRead(A15));Serial.print("  ");
}
--------------------------------------------------------------------


Pages: [1]