Analog to digital converter with timer 1 ctc mode

i´m making an analog to digital converter with timer 1 ctc mode and it shows me these message (data section exceeds available space in board)

@retgui1221, your topic has been moved to a more suitable location on the forum as this has absolutely nothing to do with Avrdude, stk500 or Bootloader issues.

Can't view the TinkerCAD page without registering :angry:

Not sure but I think that the message sounds like your ran out of flash memory.

Yes it rans out of memory, what can i do?
You have to create an account in tinkercad and then you can have access to it.

No idea; any option to select a board with more memory?

Not planning to do that any time soon. You have the code, why not post it here (don't forget code tags)?

volatile boolean isrOnB = false;
volatile boolean aReady;
volatile boolean myFileDo = false;
volatile char buffA[2049];
volatile char buffB[2049];
volatile int buffCnt = 0;

void setupISR()
 Serial.println(F("enter setupISR())"));
  cli();//disable interrupts  
  //      *** ADC SETUP ***
  ADCSRA = 0; // clear before adding bits
  ADCSRB = 0; // clear before adding bits
  ADMUX |= (1 << MUX0); //setting input pin A7
  ADMUX |= (1 << MUX1); //setting input pin A7
  ADMUX |= (1 << MUX2); //set input pin A7
  ADMUX |= (1 << ADLAR); //left align the ADC value- so we can read highest 8 bits from ADCH register only
  bitSet(ADMUX, REFS0); // reference range = ground to AVCC (Analog VCC)
  //ADCSRA |= (1 << ADPS1) | (1 << ADPS2); //set ADC clock
  ADCSRA |= (1 << ADIE); //enable interrupts when measurement complete
  //ADCSRA |= (1 << ADEN); //enable ADC  //why this line stops it?
  //bitSet(ADCSRA,ADSC); //start ADC measurements

  TCCR1A = 0;// set entire TCCR1A register to 0
  TCCR1B = 0;// same for TCCR1B
  TCNT1  = 0;//initialize counter value to 0
  OCR1A = 221;// how high to count before intterrupt occurs (must be < 65536)
  TCCR1B |= (1 << WGM12); // turn on CTC (Clear Timer on Compare) mode
  TCCR1B |= (1 << CS11);                  // divide by 1
  TIMSK1 |= (1 << OCIE1A);// enable timer compare interrupt

  sei();//enable interrupts
  Serial.println(F("exit setupISR()"));

  isrOnB = true;
  if (buffCnt == 2047)
    buffCnt = 0;
    aReady = !aReady;
    myFileDo = true;
  bitSet(ADCSRA,ADSC); //start ADC measurements

void doFile()
  myFileDo = false;
  if (aReady)
    Serial.println(F("Process buffB")); // Actually, ",2048);" in my full sketch.
    Serial.println(F("Process buffA")); // Actually, ",2048);" in my full sketch.

void setup()

void loop()
  if (isrOnB)
    isrOnB = false;
    Serial.println(F("isrOnB == true"));
  if (myFileDo)

I used pin A0 instead of A7 that why CS11

That's a lot of memory. You will need at least a Mega to run the sketch.

It looks like you are trying to read the ADC at 72 kHz! I don't see where you are setting the ADC clock to get that speed.

It takes 13 clock cycles to get a reading. To get 72 kHz readings you have to clock the ADC at 936 kHz or faster. You can set the clock to 1 MHz using the /16 prescale. You lose 4.5 bits of accuracy so the bottom 2.5 bits of your 8-bit samples will be unreliable.

I would use free-running mode (start a new ADC conversion as soon as a conversion is complete) and use the Conversion Complete interrupt for timing.

If you meant "divide by 1" you want CS10, not CS11. Setting CS11 will divide by 8, I think.