Advertisement
dzieciol

timery zadanie 2

Nov 24th, 2017
431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. #include<avr/io.h>
  2.  
  3.  
  4.  
  5. int main(void){
  6.     TCCR0 |=  (1<<CS00);// | (1<<CS01);
  7.     TCCR0 |= ~(1<<CS01);
  8.     DDRA = 0xFF;
  9.  
  10.      while (1){
  11.         PORTA = 0x00;
  12.         opuzn(200);
  13.         PORTA = 0xFF;
  14.         opuzn(200);
  15.     }
  16.  
  17. }
  18.  
  19. int opuzn(int czas){
  20.    
  21. while(1){
  22.  
  23.     if(TIFR & (1<<TOV0)){
  24.         TIFR |= (1<<TOV0);
  25.         TCNT0 = 255 - czas;    
  26.         return 0;
  27.     }  
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement