Advertisement
dzieciol

zadanie 2 a

Nov 24th, 2017
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include<avr/io.h>
  2.  
  3.  
  4.  
  5. int main(void){
  6.  
  7. DDRB = 0xFF;
  8. PORTB = 0xFF;
  9.  
  10. TCCR0 |= ((1<<WGM01) | (1<<WGM00));
  11. TCCR0 |= ((1<<COM01) | (1<<COM00));
  12.  
  13. TCCR0 |= (1<<CS00);
  14.  
  15. int licz = 0;
  16. while (1){
  17.  
  18. for(licz = 0; licz < 255; licz++){
  19. OCR0 = licz;
  20. for (int i = 0; i< 100; i++)__asm__ ( "nop;");
  21. }
  22.  
  23. for(licz = 255; licz > 0; licz--){
  24. //_delay_ms(5);
  25. for (int i = 0; i< 100; i++)__asm__ ( "nop;");
  26. }
  27. }
  28.  
  29. }
  30.  
  31. /*
  32. int opuzn(int czas){
  33.  
  34. while(1){
  35.  
  36. if(TIFR & (1<<TOV0)){
  37. TIFR |= (1<<TOV0);
  38. TCNT0 = 255 - czas;
  39. return 0;
  40. }
  41. }
  42. }
  43. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement