Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <avr/io.h>
- #include <avr/interrupt.h>
- #define init_val 130
- volatile unsigned char a;
- int main(void)
- {
- a = 20;
- DDRA = 0xFF;
- TCCR0 = (1 << CS02) | (1 << CS00) | (1 << WGM01);
- OCR0 = init_val;
- TIMSK |= (1 << OCIE0);
- sei();
- while(1);
- }
- ISR (TIMER0_COMP_vect)
- {
- a--;
- if(a == 0)
- {
- a = 20;
- PORTA ^= 0xFF;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement