Advertisement
dzieciol

przerwania zadanie1

Dec 1st, 2017
446
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. #include<avr/io.h>
  2. #include<avr/interrupt.h>
  3.  
  4.     volatile int counter;
  5. ISR(TIMER0_OVF_vect){
  6.  
  7.    
  8. if(counter == 20){
  9.     counter = 0;
  10.     PORTA = !PORTA;
  11. }
  12.    
  13.     TCNT0 = 235;
  14.     counter++;
  15.  
  16. }
  17.  
  18.  
  19. int main(void){
  20.    
  21.  
  22.     TCCR0 |=  (1<<CS00) | (1<<CS02);
  23.     TIMSK |= (1<<TOIE0);
  24.  
  25.  
  26.     TCNT0 = 0;
  27.     DDRA = 0xFF;
  28.     sei();
  29.     PORTA = 235;
  30.     counter = 0;
  31.     while(1){}
  32.  
  33.      
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement