Skip to content

Instantly share code, notes, and snippets.

@theresalu
Created April 23, 2015 12:24
Show Gist options
  • Save theresalu/1d608ef6c14896e9c47a to your computer and use it in GitHub Desktop.
Save theresalu/1d608ef6c14896e9c47a to your computer and use it in GitHub Desktop.
Timer1; 3.3ms
#include <avr/io.h>
#include <avr/interrupt.h>
void initTimer1()
{
TIMSK |= (1<<TOIE1); // 4; 0x04; (1<<2); 0b00000100; _bv(2);
sei(); // gloable Interrupts aktivieren
TCCR1B |= (1<<CS10); // Prescaler = 1
}
ISR(TIMER1_OVF_vect)
{
TCNT1 = 0xFFFF-3299; // (Maximalwert->Timer schaltet ím nächsten Takt)-3299
}
void main()
{
initTimer1();
while(1){};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment