Created
March 19, 2017 01:16
-
-
Save enjoycowboy/2956984ca69b11e363c063e941d6060b to your computer and use it in GitHub Desktop.
8mhz 1s timer
This file contains 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
TIMSK1 = (1<<OCIE1A); // output capture enable | |
TCCR1B = (1<<WGM12)|(1<<CS12)|(0<<CS11)|(0<<CS10); //prescaler 256 | |
OCR1A = 0x7A11; //31.250 * 256 = 8.000.000 | |
TCNT1 = 0; | |
sei(); //system enable interrupt | |
ISR(TIMER1_COMPA_vect){ | |
i++; | |
TCNT1=0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment