user85444: So I want to use this library, that uses timer1 to fetch samples from analog input on pin A0.
It works great, and so after proper detection I'd like to perform all kinds of different tasks. But for those I need timer1 again and I think this library keeps it's timer1 routine continuously running. (Am I right?)
(EDIT: clarification) I think therefore a different library using timer1 won't work as expected. That's why after the first library's task is done, I'd like to free up timer1 for the second library.)
/*
  Original text created by Jacob Rosenthal:

  The Goertzel algorithm is long standing so see
  http://en.wikipedia.org/wiki/Goertzel_algorithm for a full description.
  It is often used in DTMF tone detection as an alternative to the Fast
  Fourier Transform because it is quick with low overheard because it
  is only searching for a single frequency rather than showing the
  occurrence of all frequencies.

  This work is entirely based on the Kevin Banks code found at
  http://www.embedded.com/design/configurable-systems/4024443/The-Goertzel-Algorithm
  so full credit to him for his generic implementation and breakdown. I've
  simply massaged it into an Arduino library. I recommend reading his article
  for a full description of whats going on behind the scenes.

  Created by Jacob Rosenthal, June 20, 2012.
  Released into the public domain.

  Modifications 6v6gt 09.09.2019
  1. Restructure instance variables to permit multiple instances of class.
  2. Make sample array static to share it between instances
  3. Pass in sample array as pointer so it can be reused outside class.
  4. Drive ADC by timer1 instead of polling ADC in loop()
      and reduce resolution to 8 bits.
  5. Separate coeeficient calculation from constructor because it
       now relies on data unknown at invocation (sample rate)
  5. Some consolidation of methods.
  6. Software "as is". No claims made about its suitability for any use.
       Use at your own risk. Special care required if you use other
       analog inputs or an AVR chip other than ATmega328P (Uno etc.).
*/


#include "Arduino.h"
#include "Goertzel.h"

// set by Goertzel::init()
uint8_t * Goertzel::testData;             // static declaration in .h
uint16_t Goertzel::N ;                    // ditto
uint16_t Goertzel::SAMPLING_FREQUENCY ;   // ditto

volatile bool Goertzel::testDataReady = false ; // static declaration in .h


//ADC interrupt service routine
ISR(ADC_vect) {
  // load sample buffer on sample conversion.
  static uint16_t sampleIndex = 0 ;
  if ( ! Goertzel::testDataReady   ) {
    if ( sampleIndex < Goertzel::N  ) {
      *(Goertzel::testData + sampleIndex++ )  = ADCH ; // 8 bits. Direct adressing into byte buffer
    }
    else  {
      Goertzel::testDataReady = true ;    // make buffer available to consumer
      sampleIndex = 0 ;
    }
  }
  TIFR1 = _BV(ICF1); // reset interrupt flag
}


// constructor
Goertzel::Goertzel(float TARGET_FREQUENCY  )
{
  _TARGET_FREQUENCY = TARGET_FREQUENCY; //should be integer of SAMPLING_RATE/N
}


//static method
void Goertzel::init( uint8_t *sampleArray , uint16_t sampleArraySize, uint16_t sampleFrequency ) {
  // set up sample array, number of samples and sample frequency.

  // load class static variables
  testData = sampleArray ;
  N = sampleArraySize ;
  SAMPLING_FREQUENCY = sampleFrequency ;


  // initialise ADC and Timer1. Timer1 triggers ADC at frequency SAMPLING_FREQUENCY.
  // ISR(ADC_vect) called when conversion complete.
  cli() ;

  // Setup Timer1 for chosen sampling frequency.
  TCCR1A = 0;
  TCCR1B = _BV(CS10)  |    // Bit 2:0 – CS12:0: Clock Select =  no prescaler
           _BV(WGM13) |    // WGM 12 = CTC ICR1 Immediate MAX
           _BV(WGM12);     // WGM 12 ditto
  ICR1 = ( (F_CPU ) / SAMPLING_FREQUENCY ) - 1;


  // Setup ADC for triggering by timer1; 8bit resolution; Analog Port PC0 (pin A0) ADMUX
  ADMUX =  _BV(REFS0) ;    // Fixed AVcc reference voltage for ATMega328P
  ADMUX |= _BV(ADLAR) ;    // left adjust conversion result in ADCH (8bit)
  DIDR0 |= _BV(ADC0D);     // DIDR0  Digital Input Disable Register 0
  ADCSRB = _BV(ADTS2) |    // Bit 2:0  ADTS[2:0]: ADC Auto Trigger Source
           _BV(ADTS1) |    // Timer/Counter1 Capture Event
           _BV(ADTS0);     // ditto


  ADCSRA = _BV(ADEN) |      // Bit 7   ADEN: ADC Enable
           _BV(ADSC) |      // Bit 6   ADSC: ADC Start Conversion
           _BV(ADATE) |     // Bit 5   ADATE: ADC Auto Trigger Enable
           _BV(ADIE) |      //
           _BV(ADPS0) |     // Bits 2:0  ADPS[2:0]: ADC Prescaler Select Bits  (div 8 )
           _BV(ADPS1);      // ditto
  sei() ;

}



// instance method
void Goertzel::getCoefficient( void ) {
  // previously in constructor. Now SAMPLING_FREQUENCY unknown at invocation time.
  float omega = (2.0 * PI * _TARGET_FREQUENCY) / SAMPLING_FREQUENCY;
  coeff = 2.0 * cos(omega);
}



// instance method
float Goertzel::detect()
{
  Q2 = 0;
  Q1 = 0;
  for ( uint16_t index = 0; index < N; index++)
  {
    // byte sample is ( *( testData + index ) );
    float Q0;
    Q0 = coeff * Q1 - Q2 + (float) ( *( testData + index ) - 128 ) ; //  128 for 8bit; 512 for 10bit resolution.
    Q2 = Q1;
    Q1 = Q0;
  }

  /* standard Goertzel processing. */
  float magnitude = sqrt(Q1 * Q1 + Q2 * Q2 - coeff * Q1 * Q2);
  return magnitude  ;
}

I'm new to using timers on Arduino, but I want to understand and learn more about it. So I'm reading up on it. Seeing that it's not the easiest subject to wrap my head around I'd like to ask for some directions.
On this splendid page I gathered some examples of stopping / disabling timer1.
  TCCR1B = 0;    
  TIMSK1 = 0;    // disable Timer1 Interrupt

Nick Gammons Timer info page
However I don't completely recognise the usage of the library's timer names, registers, variables yet. And so I'm unsure what part of the code is doing what exactly, ie where, how and when the timer starts. And therefore I'm equally unsure how to go about stopping it when the task is done, and to start it again when a new detection is needed. It seems there is TCCR1A, TCCR1B, cli() and sei() that have something to do with it and ISR(ADC_vect). One of you probably knows ;)
EDIT: Reading the suggested ATmega328p datasheet I found out a little bit more about the following abbreviations:
cli // disable interrupts during timed sequence __disable_interrupt();
sei // Set global Interrupt Enable __enable_interrupt();
TCNT1 // Timer/Counter (setting 0 will reset)
TIFR1 // Timer Interrupt Flag Register
TCCR1A // Timer/Counter Control Register 1a (setting 0 will reset)
TCCR1B // Timer/Counter Control Register 1b (setting 0 will reset)
TIMSK1 // Timer Interrupt Mask Register
ICR1 // Input Capture Register
ICF1 // Input Capture Flag
ICP1 // Input Capture Pin
WGM // Waveform Generation Mode
CS // Clock Select Bits (prescaler??)
F_CPU // The CPU speed (What is the default value? 8000000??? 1000000??? 16000000???)
DIDR1/DIDR0 // Digital Input Disable Registers (if left enabled they will use excessive power when Analog input is floating or close to VCC/2)
ADMUX // ADC Multiplexer Selection Register
REFS1 & REFS0 // Voltage Reference Selection
ADLAR // ADC Left Adjust Result
MUX
ADEN // ADC Enable
ADSC // ADC Start Conversion
ADATE // ADC Auto Trigger Enable
ADTS // ADC Trigger Source Select 
ADCSRB // 
ADIE // ADC Conversion Complete Interrupt Enable
ADPS0 & ADPS0 // ADC Prescaler Select Bits


But hasn't really lightened things up entirely for me. What is _BV? for example.
EDIT: I think I'm starting to make sense of it more. Am I right here(??):
ADMUX = (0b00 << REFS0) | (1 << ADLAR) | (0b00000 << MUX0);
Is the same as:
ADMUX = (0b00 << REFS0); // 0 shift has no effect so can be omitted
ADMUX |= (1 << ADLAR); 
ADMUX |= (0b00000 << MUX0); // 0 shift has no effect so can be omitted
Is de same as:
ADMUX = (1 << REFS0); // can be omitted
ADMUX |= (1 << ADLAR);
ADMUX |= (1 << MUX0); // can be omitted
is the same as:
ADMUX = _BV(REFS0); // can be omitted
ADMUX |= _BV(ADLAR);
ADMUX |= _BV(MUX0); // can be omitted
Is the same as:
ADMUX = (1 << ADLAR); 
Is the same as: 
ADMUX = _BV(ADLAR);

Understanding it all would be great, but may be unnecessary.
If only I'd know how I can stop and free Timer1 usage for other purposes. Starting it all up again would be easier I guess ;)

user10794: I'm not sure why you need to stop the timer in the first place. Timers are just things that count "ticks" which can be programmed to arrive at various speeds (usually some division of the processor speed).
Imagine you have a clock in your kitchen. And imagine you are baking a cake. You observe the time that you put the cake into the oven. Then you note at what time the cake will be done. Meanwhile that same clock can be used to time boiling an egg. You don't need to stop or "reset" the clock to achieve this.
Just let the clock run and do its thing, and meanwhile make a note of what time needs to arrive for things to be "done".
Meanwhile, the Uno (and Nano) have other timers. You can use those. It's like owning three clocks, that can run at different speeds — or perhaps more accurately — different levels of precision.

user7508: I am answering here only a tiny part of the question:

ADMUX = (0b00 << REFS0); // 0 shift has no effect so can be omitted
ADMUX |= (1 << ADLAR); 
ADMUX |= (0b00000 << MUX0); // 0 shift has no effect so can be omitted

Is de same as:
ADMUX = (1 << REFS0); // can be omitted
ADMUX |= (1 << ADLAR);
ADMUX |= (1 << MUX0); // can be omitted


No, it is not the same.
Starting from the first line: (0b00 << REFS0) means “zero
left-shifted by REFS0 (i.e. six) bits”. It is not a zero shift, as
stated in the comment: it is a 6-bit shift. The resulting value is zero,
because the number being shifted is zero to start with, and because
vacated bits are zero-filled during a left-shift.
In contrast, (1 << REFS0) means “one left-shifted by REFS0 bits”.
The resulting value is:
2REFS0 = 26 = 0b01000000 = 64
In the first code snippet, ADMUX ends up with only the ADLAR bit being
set. In the second snippet, all three bits (REFS0, ADLAR and MUX0) are
set.
Edit: explaining the notion that “vacated bits are zero-filled
during a left-shift”. Let's assume x = 0bABCDEFGH is a byte, where A…H
are the individual bits (“0b” is a prefix meaning “what follows is in
binary”). Left-shifting this byte gives the following:
x << 0 = 0bABCDEFGH
x << 1 = 0bBCDEFGH0
x << 2 = 0bCDEFGH00
x << 3 = 0bDEFGH000
...

By “vacated bits are zero-filled” I mean that the bits that are beyond
the last original bit (beyond H) are replaced by zeros. Note that a zero
shift “has no effect” in the sense that x<<0 is the same as x. Note
also that shifting the value zero by any amount always yields zero.
In this particular code, the value being written to ADMUX can be
computed as follows:
1 << REFS0 = 1 << 6 = 0b00000001 << 6 = 0b01000000
1 << ADLAR = 1 << 5 = 0b00000001 << 5 = 0b00100000
1 << MUX0  = 1 << 0 = 0b00000001 << 0 = 0b00000001
──────────────────────────────────────────────────
(1<<REFS0) | (1<<ADLAR) | (1<<MUX0)   = 0b01100001


85444: <p>So I want to use this library, that uses timer1 to fetch samples from analog input on pin A0.
It works great, and so after proper detection I'd like to perform all kinds of different tasks. But for those I need timer1 again and I think this library keeps it's timer1 routine continuously running. (Am I right?)</p>
<p>(EDIT: clarification) I think therefore a different library using timer1 won't work as expected. That's why after the first library's task is done, I'd like to free up timer1 for the second library.)</p>
<pre><code>/*
  Original text created by Jacob Rosenthal:

  The Goertzel algorithm is long standing so see
  http://en.wikipedia.org/wiki/Goertzel_algorithm for a full description.
  It is often used in DTMF tone detection as an alternative to the Fast
  Fourier Transform because it is quick with low overheard because it
  is only searching for a single frequency rather than showing the
  occurrence of all frequencies.

  This work is entirely based on the Kevin Banks code found at
  http://www.embedded.com/design/configurable-systems/4024443/The-Goertzel-Algorithm
  so full credit to him for his generic implementation and breakdown. I've
  simply massaged it into an Arduino library. I recommend reading his article
  for a full description of whats going on behind the scenes.

  Created by Jacob Rosenthal, June 20, 2012.
  Released into the public domain.

  Modifications 6v6gt 09.09.2019
  1. Restructure instance variables to permit multiple instances of class.
  2. Make sample array static to share it between instances
  3. Pass in sample array as pointer so it can be reused outside class.
  4. Drive ADC by timer1 instead of polling ADC in loop()
      and reduce resolution to 8 bits.
  5. Separate coeeficient calculation from constructor because it
       now relies on data unknown at invocation (sample rate)
  5. Some consolidation of methods.
  6. Software &quot;as is&quot;. No claims made about its suitability for any use.
       Use at your own risk. Special care required if you use other
       analog inputs or an AVR chip other than ATmega328P (Uno etc.).
*/


#include &quot;Arduino.h&quot;
#include &quot;Goertzel.h&quot;

// set by Goertzel::init()
uint8_t * Goertzel::testData;             // static declaration in .h
uint16_t Goertzel::N ;                    // ditto
uint16_t Goertzel::SAMPLING_FREQUENCY ;   // ditto

volatile bool Goertzel::testDataReady = false ; // static declaration in .h


//ADC interrupt service routine
ISR(ADC_vect) {
  // load sample buffer on sample conversion.
  static uint16_t sampleIndex = 0 ;
  if ( ! Goertzel::testDataReady   ) {
    if ( sampleIndex &lt; Goertzel::N  ) {
      *(Goertzel::testData + sampleIndex++ )  = ADCH ; // 8 bits. Direct adressing into byte buffer
    }
    else  {
      Goertzel::testDataReady = true ;    // make buffer available to consumer
      sampleIndex = 0 ;
    }
  }
  TIFR1 = _BV(ICF1); // reset interrupt flag
}


// constructor
Goertzel::Goertzel(float TARGET_FREQUENCY  )
{
  _TARGET_FREQUENCY = TARGET_FREQUENCY; //should be integer of SAMPLING_RATE/N
}


//static method
void Goertzel::init( uint8_t *sampleArray , uint16_t sampleArraySize, uint16_t sampleFrequency ) {
  // set up sample array, number of samples and sample frequency.

  // load class static variables
  testData = sampleArray ;
  N = sampleArraySize ;
  SAMPLING_FREQUENCY = sampleFrequency ;


  // initialise ADC and Timer1. Timer1 triggers ADC at frequency SAMPLING_FREQUENCY.
  // ISR(ADC_vect) called when conversion complete.
  cli() ;

  // Setup Timer1 for chosen sampling frequency.
  TCCR1A = 0;
  TCCR1B = _BV(CS10)  |    // Bit 2:0 – CS12:0: Clock Select =  no prescaler
           _BV(WGM13) |    // WGM 12 = CTC ICR1 Immediate MAX
           _BV(WGM12);     // WGM 12 ditto
  ICR1 = ( (F_CPU ) / SAMPLING_FREQUENCY ) - 1;


  // Setup ADC for triggering by timer1; 8bit resolution; Analog Port PC0 (pin A0) ADMUX
  ADMUX =  _BV(REFS0) ;    // Fixed AVcc reference voltage for ATMega328P
  ADMUX |= _BV(ADLAR) ;    // left adjust conversion result in ADCH (8bit)
  DIDR0 |= _BV(ADC0D);     // DIDR0  Digital Input Disable Register 0
  ADCSRB = _BV(ADTS2) |    // Bit 2:0  ADTS[2:0]: ADC Auto Trigger Source
           _BV(ADTS1) |    // Timer/Counter1 Capture Event
           _BV(ADTS0);     // ditto


  ADCSRA = _BV(ADEN) |      // Bit 7   ADEN: ADC Enable
           _BV(ADSC) |      // Bit 6   ADSC: ADC Start Conversion
           _BV(ADATE) |     // Bit 5   ADATE: ADC Auto Trigger Enable
           _BV(ADIE) |      //
           _BV(ADPS0) |     // Bits 2:0  ADPS[2:0]: ADC Prescaler Select Bits  (div 8 )
           _BV(ADPS1);      // ditto
  sei() ;

}



// instance method
void Goertzel::getCoefficient( void ) {
  // previously in constructor. Now SAMPLING_FREQUENCY unknown at invocation time.
  float omega = (2.0 * PI * _TARGET_FREQUENCY) / SAMPLING_FREQUENCY;
  coeff = 2.0 * cos(omega);
}



// instance method
float Goertzel::detect()
{
  Q2 = 0;
  Q1 = 0;
  for ( uint16_t index = 0; index &lt; N; index++)
  {
    // byte sample is ( *( testData + index ) );
    float Q0;
    Q0 = coeff * Q1 - Q2 + (float) ( *( testData + index ) - 128 ) ; //  128 for 8bit; 512 for 10bit resolution.
    Q2 = Q1;
    Q1 = Q0;
  }

  /* standard Goertzel processing. */
  float magnitude = sqrt(Q1 * Q1 + Q2 * Q2 - coeff * Q1 * Q2);
  return magnitude  ;
}
</code></pre>
<p>I'm new to using timers on Arduino, but I want to understand and learn more about it. So I'm reading up on it. Seeing that it's not the easiest subject to wrap my head around I'd like to ask for some directions.</p>
<p>On this splendid page I gathered some examples of stopping / disabling timer1.</p>
<pre><code>  TCCR1B = 0;    
  TIMSK1 = 0;    // disable Timer1 Interrupt
</code></pre>
<p><a href="https://www.gammon.com.au/timers" rel="nofollow noreferrer">Nick Gammons Timer info page</a></p>
<p>However I don't completely recognise the usage of the library's timer names, registers, variables yet. And so I'm unsure what part of the code is doing what exactly, ie where, how and when the timer starts. And therefore I'm equally unsure how to go about stopping it when the task is done, and to start it again when a new detection is needed. It seems there is TCCR1A, TCCR1B, cli() and sei() that have something to do with it and ISR(ADC_vect). One of you probably knows ;)</p>
<p>EDIT: Reading the suggested <a href="https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf" rel="nofollow noreferrer">ATmega328p datasheet</a> I found out a little bit more about the following abbreviations:</p>
<pre><code>cli // disable interrupts during timed sequence __disable_interrupt();
sei // Set global Interrupt Enable __enable_interrupt();
TCNT1 // Timer/Counter (setting 0 will reset)
TIFR1 // Timer Interrupt Flag Register
TCCR1A // Timer/Counter Control Register 1a (setting 0 will reset)
TCCR1B // Timer/Counter Control Register 1b (setting 0 will reset)
TIMSK1 // Timer Interrupt Mask Register
ICR1 // Input Capture Register
ICF1 // Input Capture Flag
ICP1 // Input Capture Pin
WGM // Waveform Generation Mode
CS // Clock Select Bits (prescaler??)
F_CPU // The CPU speed (What is the default value? 8000000??? 1000000??? 16000000???)
DIDR1/DIDR0 // Digital Input Disable Registers (if left enabled they will use excessive power when Analog input is floating or close to VCC/2)
ADMUX // ADC Multiplexer Selection Register
REFS1 &amp; REFS0 // Voltage Reference Selection
ADLAR // ADC Left Adjust Result
MUX
ADEN // ADC Enable
ADSC // ADC Start Conversion
ADATE // ADC Auto Trigger Enable
ADTS // ADC Trigger Source Select 
ADCSRB // 
ADIE // ADC Conversion Complete Interrupt Enable
ADPS0 &amp; ADPS0 // ADC Prescaler Select Bits

</code></pre>
<p>But hasn't really lightened things up entirely for me. What is _BV? for example.</p>
<p>EDIT: I think I'm starting to make sense of it more. Am I right here(??):</p>
<pre><code>ADMUX = (0b00 &lt;&lt; REFS0) | (1 &lt;&lt; ADLAR) | (0b00000 &lt;&lt; MUX0);
Is the same as:
ADMUX = (0b00 &lt;&lt; REFS0); // 0 shift has no effect so can be omitted
ADMUX |= (1 &lt;&lt; ADLAR); 
ADMUX |= (0b00000 &lt;&lt; MUX0); // 0 shift has no effect so can be omitted
Is de same as:
ADMUX = (1 &lt;&lt; REFS0); // can be omitted
ADMUX |= (1 &lt;&lt; ADLAR);
ADMUX |= (1 &lt;&lt; MUX0); // can be omitted
is the same as:
ADMUX = _BV(REFS0); // can be omitted
ADMUX |= _BV(ADLAR);
ADMUX |= _BV(MUX0); // can be omitted
Is the same as:
ADMUX = (1 &lt;&lt; ADLAR); 
Is the same as: 
ADMUX = _BV(ADLAR);
</code></pre>
<p>Understanding it all would be great, but may be unnecessary.
If only I'd know how I can stop and free Timer1 usage for other purposes. Starting it all up again would be easier I guess ;)</p>
 10794: <p>I'm not sure why you need to stop the timer in the first place. Timers are just things that count &quot;ticks&quot; which can be programmed to arrive at various speeds (usually some division of the processor speed).</p>
<p>Imagine you have a clock in your kitchen. And imagine you are baking a cake. You observe the time that you put the cake into the oven. Then you note at what time the cake will be done. Meanwhile that same clock can be used to time boiling an egg. You don't need to stop or &quot;reset&quot; the clock to achieve this.</p>
<p>Just let the clock run and do its thing, and meanwhile make a note of what time needs to arrive for things to be &quot;done&quot;.</p>
<p>Meanwhile, the Uno (and Nano) have other timers. You can use those. It's like owning three clocks, that can run at different speeds — or perhaps more accurately — different levels of precision.</p>
 7508: <p>I am answering here only a tiny part of the question:</p>
<blockquote>
<pre class="lang-cpp prettyprint-override"><code>ADMUX = (0b00 &lt;&lt; REFS0); // 0 shift has no effect so can be omitted
ADMUX |= (1 &lt;&lt; ADLAR); 
ADMUX |= (0b00000 &lt;&lt; MUX0); // 0 shift has no effect so can be omitted
</code></pre>
<p>Is de same as:</p>
<pre class="lang-cpp prettyprint-override"><code>ADMUX = (1 &lt;&lt; REFS0); // can be omitted
ADMUX |= (1 &lt;&lt; ADLAR);
ADMUX |= (1 &lt;&lt; MUX0); // can be omitted
</code></pre>
</blockquote>
<p>No, it is not the same.</p>
<p>Starting from the first line: <code>(0b00 &lt;&lt; REFS0)</code> means “<strong>zero</strong>
left-shifted by REFS0 (i.e. six) bits”. It is not a zero shift, as
stated in the comment: it is a 6-bit shift. The resulting value is zero,
because the number being shifted is zero to start with, and because
vacated bits are zero-filled during a left-shift.</p>
<p>In contrast, <code>(1 &lt;&lt; REFS0)</code> means “<strong>one</strong> left-shifted by REFS0 bits”.
The resulting value is:</p>
<p>2<sup>REFS0</sup> = 2<sup>6</sup> = 0b01000000 = 64</p>
<p>In the first code snippet, ADMUX ends up with only the ADLAR bit being
set. In the second snippet, all three bits (REFS0, ADLAR and MUX0) are
set.</p>
<p><strong>Edit</strong>: explaining the notion that “vacated bits are zero-filled
during a left-shift”. Let's assume x = 0bABCDEFGH is a byte, where A…H
are the individual bits (“0b” is a prefix meaning “what follows is in
binary”). Left-shifting this byte gives the following:</p>
<pre><code>x &lt;&lt; 0 = 0bABCDEFGH
x &lt;&lt; 1 = 0bBCDEFGH0
x &lt;&lt; 2 = 0bCDEFGH00
x &lt;&lt; 3 = 0bDEFGH000
...
</code></pre>
<p>By “vacated bits are zero-filled” I mean that the bits that are beyond
the last original bit (beyond H) are replaced by zeros. Note that a zero
shift “has no effect” in the sense that <code>x&lt;&lt;0</code> is the same as <code>x</code>. Note
also that shifting the value zero by any amount always yields zero.</p>
<p>In this particular code, the value being written to ADMUX can be
computed as follows:</p>
<pre><code>1 &lt;&lt; REFS0 = 1 &lt;&lt; 6 = 0b00000001 &lt;&lt; 6 = 0b01000000
1 &lt;&lt; ADLAR = 1 &lt;&lt; 5 = 0b00000001 &lt;&lt; 5 = 0b00100000
1 &lt;&lt; MUX0  = 1 &lt;&lt; 0 = 0b00000001 &lt;&lt; 0 = 0b00000001
──────────────────────────────────────────────────
(1&lt;&lt;REFS0) | (1&lt;&lt;ADLAR) | (1&lt;&lt;MUX0)   = 0b01100001
</code></pre>
