Created
April 23, 2015 12:24
-
-
Save theresalu/1d608ef6c14896e9c47a to your computer and use it in GitHub Desktop.
Timer1; 3.3ms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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