hier mein funktionsfähiger code![]()
Code:#include <avr/signal.h> #include <avr/interrupt.h> #include <stdio.h> #include <avr/io.h> volatile char bByte = 0; SIGNAL(SIG_INTERRUPT0) { bByte |= 1; } main() { DDRA = 0xFF; DDRD = 0x00; PORTA=0xF0; PORTD=0xFF; sei(); // Alle Interrupts enablen // definieren speziellen Interrupt & enablen MCUCR = 2; // GICR=0x40; while (1) { if ( bByte & 1) // warten auf interrupt { bByte &= ~1; // zurücksetzen PORTA=~PORTA; } } }
Lesezeichen