Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define F_CPU 7372800UL
- #include <avr/io.h>
- #include <avr/interrupt.h>
- #include <util/delay.h>
- void debouncer(){
- _delay_ms(200);
- GIFR = _BV(INTF0) | _BV(INTF1);
- }
- void blink(){
- uint8_t i;
- for(i=0; i<10; i++){
- //PORTA ^= 0xff; // ovo radi
- PORTA = ~PORTA; // ovo ne
- _delay_ms(250);
- }
- }
- ISR(INT0_vect){
- if(PORTA == 0x00){
- blink();
- }
- PORTA = PORTA << 1;
- debouncer();
- }
- ISR(INT1_vect){
- PORTA = PORTA >> 1;
- PORTA |= 0x80;
- debouncer();
- }
- 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