Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #define F_CPU 16000000L
  2. #include <avr/io.h>
  3. #include <util/delay.h>
  4. #include <avr/interrupt.h>
  5.  
  6. volatile int8_t counter=-1;
  7. volatile uint8_t seg[4]={0b01001100, 0b01000001, 0b01000011, 0b01001000};
  8.  
  9. ISR(TIMER0_OVF_vect)
  10. {
  11. PORTB=255;
  12. wysw++;
  13. if (counter==4) counter=0;
  14. PORTA=seg[counter];
  15. PORTB=~_BV(counter);
  16. }
  17. void main(void)
  18. {
  19. DDRA=255;
  20. DDRB=0x0F;
  21. sei();
  22. TIMSK|=_BV(TOIE0);
  23. TCCR0|=_BV(CS00)|_BV(CS01);
  24.  
  25. while (1)
  26. {
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement