Hi, I have seen this program

\begin{lstlisting}

const byte adcPin = 0; // A0

const int MAX_RESULTS = 256;

volatile int results [MAX_RESULTS];
volatile int resultNumber;

{
if (resultNumber >= MAX_RESULTS)
else

EMPTY_INTERRUPT (TIMER1_COMPB_vect);

void setup ()
{
Serial.begin (115200);
Serial.println ();

// reset Timer 1
TCCR1A = 0;
TCCR1B = 0;
TCNT1 = 0;
TCCR1B = bit (CS11) | bit (WGM12); // CTC, prescaler of 8
TIMSK1 = bit (OCIE1B); // WTF?
OCR1A = 39;
OCR1B = 39; // 20 uS - sampling frequency 50 kHz

// wait for buffer to fill
while (resultNumber < MAX_RESULTS)
{ }

for (int i = 0; i < MAX_RESULTS; i++)
Serial.println (results );

• } // end of setup*
void loop () { }
\end{lstlisting}
on this site:
Gammon Forum : Electronics : Microprocessors : ADC conversion on the Arduino (analogRead)
I’m not an expert of Arduino but my professor have used it to read some voltage values and I want to understand a bit more about this program.
1) I know what a isr() is, but what is ISR(ADC_vect)?
2)I know what a trigger is but in this program what does automatic triggering do?
3) I don’t understand what the while does, how does it knew when the buffer is full? There is nothing in the while

The Arduino uses an AVR processor.
Now, combine that useful nugget of information with “ADC_vect”, and what do you get from Mr Google?

Please remember to use code tags when posting code

The ATmega328P Datasheet would be an essential read for understanding this code.

2)I know what a trigger is but in this program what does automatic triggering do?

1. I don't understand what the while does

Nothing, until the while condition becomes true.

The comment is not the sign of a knowledgeable programmer, but this line is in fact essential.

  TIMSK1 = bit (OCIE1B);  // WTF?


jremington:
The comment is not the sign of a knowledgeable programmer, but this line is in fact essential.

  TIMSK1 = bit (OCIE1B);  // WTF?


This isn’t too good either:

while (resultNumber < MAX_RESULTS)
{ }


Accesses of the 16-bit ‘resultNumber’ variable will be non-atomic on an 8-bit AVR. They need to be protected by a Critical Section.