user34513: Does somebody know what can be wrong in this, where I try to set Timer1 interrupt in Arduino Mega in C code only. I'm trying CTC Mode and the purpose is LED blinking with 1[s] Period. 
I work with documentation program doesn't work completely.
 #include <avr/io.h>
 #include <avr/interrupt.h>



 void setup() 
 {
   //LED -> PB7 (Digital pin 13 
     DDRB |= (1<<PB7); 

  //FCPU = 16MHz, Prescaler :256 | CTC
   TCCR1B |= (1<<CS12) | (1<<WGM12);
   TIMSK1 |= (1<<OCIE1A);  // Compare Match A interrupt allowing
     OCR1A = 62500;

    sei();
    }

  void loop() 
  {

   }

   ISR(TIMER1_COMPA_vect)
   {
     PORTB ^= (1<<PB7); 
    }


user30005: 
I work with documentation program doesn't work completely.

simple:
1) check out the datasheet;
2) identify those registers needed to get tmr1 to work;
3) set or clear, as appropriate, ALL bits that are needed. Do NOT rely on default values.
4) done.

34513: <p>Does somebody know what can be wrong in this, where I try to set Timer1 interrupt in Arduino Mega in C code only. I'm trying CTC Mode and the purpose is LED blinking with 1[s] Period. </p>

<p>I work with documentation program doesn't work completely.</p>

<pre><code> #include &lt;avr/io.h&gt;
 #include &lt;avr/interrupt.h&gt;



 void setup() 
 {
   //LED -&gt; PB7 (Digital pin 13 
     DDRB |= (1&lt;&lt;PB7); 

  //FCPU = 16MHz, Prescaler :256 | CTC
   TCCR1B |= (1&lt;&lt;CS12) | (1&lt;&lt;WGM12);
   TIMSK1 |= (1&lt;&lt;OCIE1A);  // Compare Match A interrupt allowing
     OCR1A = 62500;

    sei();
    }

  void loop() 
  {

   }

   ISR(TIMER1_COMPA_vect)
   {
     PORTB ^= (1&lt;&lt;PB7); 
    }
</code></pre>
 30005: <blockquote>
  <p>I work with documentation program doesn't work completely.</p>
</blockquote>

<p>simple:</p>

<p>1) check out the datasheet;
2) identify those registers needed to get tmr1 to work;
3) set or clear, as appropriate, <strong><em>ALL</em></strong> bits that are needed. Do NOT rely on default values.
4) done.</p>
