Skip to content

Instantly share code, notes, and snippets.

/c

Created May 30, 2017 08:45
Show Gist options
  • Save anonymous/2a6c619f6a1f27f41a94e3f9bc924f6e to your computer and use it in GitHub Desktop.
Save anonymous/2a6c619f6a1f27f41a94e3f9bc924f6e to your computer and use it in GitHub Desktop.
#include <avr/io.h>
#include <avr/interrupt.h>
void warten(void) {
while ( !(TIFR1 & (1 << OCF1A ) ) )
;
TIFR1 |= (1 << OCF1A );
}
ISR(TIMER1_COMPA_vect) {
PORTB = 0;
}
ISR(TIMER1_OVF_vect) {
PORTB ^= 8;
}
int main(void) {
DDRB = 8;
PORTB = 0;
TCCR1B = (1 << CS10) ; //prescale 1
OCR1A = (16000000 / 2 / 1 / 440) - 1;
TIMSK1 |= (1 << OCIE1A) | (1 << TOIE1);
PCICR = 0x01;
sei();
while(1) {
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment