Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define F_CPU 16000000L
- #include <avr/io.h>
- #include <util/delay.h>
- #include <avr/interrupt.h>
- volatile int8_t counter=-1;
- volatile uint8_t seg[4]={0b01001100, 0b01000001, 0b01000011, 0b01001000};
- ISR(TIMER0_OVF_vect)
- {
- PORTB=255;
- wysw++;
- if (counter==4) counter=0;
- PORTA=seg[counter];
- PORTB=~_BV(counter);
- }
- void main(void)
- {
- DDRA=255;
- DDRB=0x0F;
- sei();
- TIMSK|=_BV(TOIE0);
- TCCR0|=_BV(CS00)|_BV(CS01);
- while (1)
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement