Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define F_CPU 7372800UL
- #include <avr/io.h>
- #include <util/delay.h>
- #include <avr/interrupt.h>
- void debounce(){
- _delay_ms(100);
- GIFR = _BV(INTF0) | _BV(INTF1);
- }
- //interrupt subroutine - ISR
- ISR(INT0_vect){
- PORTA = PORTA << 1; // sa INT0 left shift bits
- debounce();
- }
- ISR(INT1_vect){
- PORTA = PORTA >> 1; // sa INT1 right shift bits
- PORTA |= 0x80; //oramo da bi enablali high pinove ???
- debounce();
- }
- int main(void){
- DDRA = 0xff;
- PORTA = 0xff;
- MCUCR = _BV(ISC01) | _BV(ISC11);
- GICR = _BV(INT0) | _BV(INT1);
- sei();
- while (1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement