Created
May 14, 2019 10:30
-
-
Save avr-programmierung/2952490a7b5093d6a0f60cfae4168ac4 to your computer and use it in GitHub Desktop.
ATmega88 @ 1MHz interrupt 03
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
/* interrupt_03.c ATmega88 @ 1MHz */ #include <avr/io.h> | |
#include <avr/interrupt.h> | |
int main(void) | |
{ | |
DDRB |= (1<<PB1); // PB1 = Ausgang | |
PORTB = 0x00; // PORTB auf low | |
PCICR |= (1<<PCIE0); // Aktiviere PCINT0 (PCINT0…7) als Interruptquelle | |
PCMSK0 |= (1<<PCINT0); // Aktiviere PCINT0 als Interrupt-Pin | |
sei(); // Alle Interrupts aktivieren | |
while(1) | |
{ | |
} | |
return 0; | |
} | |
ISR (PCINT0_vect) | |
{ | |
PORTB ^= (1 << PB1); // Toggle PB1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment