On Jan 14, 2014, at 10:54 AM, dfx <d...@dfx.it> wrote: > Please consider this code:
[...] > ISR(PCINT3_vect) { // FUNCTION KEY > uint8_t i; > > i = PORTD; > if ((i & FUNC_SEL_KEY) > 0) { // Test a key > LED_PORT |= (1 << PORTB0); > _delay_ms(100); > LED_PORT &= ~(1 << PORTB0); > _delay_ms(300); > } > reti(); > } Why do you reti()? Use of ISR() should handle that for you. Plus your premature reti() prevents stack cleanup. Disassembly of an example I threw together: / // Used to wake from sleep // ISR(INT0_vect) // switch moved into "SET" position { 5fa: 1f 92 push r1 5fc: 0f 92 push r0 5fe: 0f b6 in r0, 0x3f ; 63 600: 0f 92 push r0 602: 11 24 eor r1, r1 EIMSK = 0; // disable once used 604: 1d ba out 0x1d, r1 ; 29 reti(); 606: 18 95 reti } 608: 0f 90 pop r0 60a: 0f be out 0x3f, r0 ; 63 60c: 0f 90 pop r0 60e: 1f 90 pop r1 610: 18 95 reti -- David Kelly N4HHE, dke...@hiwaay.net ============================================================ Whom computers would destroy, they must first drive mad. _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-gcc-list