Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Exp32.c
- *
- * Created: 10/23/2017 5:35:00 PM
- * Author: ASUS
- */
- /*
- * experiment03.c
- *
- * Created: 10/21/2017 9:35:09 PM
- * Author: Rifat Rahman
- */
- #define F_CPU 1000000UL
- #include <avr/io.h>
- #include <avr/interrupt.h>
- #include <util/delay.h>
- volatile char c;
- ISR(INT2_vect)
- {
- cli();
- c++;
- _delay_ms(500);
- if(c>15) c=0;
- c = c & 0x0f;
- GIFR = 0xFF;
- }
- ISR(INT0_vect)
- {
- cli();
- c--;
- _delay_ms(500);
- if(c<0) c=15;
- c = c & 0x0f;
- GIFR = 0xFF;
- }
- int main(void)
- {
- c = 0x00;
- DDRA = 0xff;
- GICR = (1 << INT0) | (1 << INT2);
- MCUCR = MCUCR | 0x2;
- MCUCSR = MCUCSR | 0xdf;
- sei();
- while(1)
- {
- //TODO:: Please write your application code
- PORTA = c;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement