Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include <avr/io.h>
  2.  
  3. void fv1(void);
  4. int main()
  5. {
  6. DDRG=0;
  7. unsigned char gomb;
  8. while(1)
  9. {
  10. gomb=PING;
  11. switch(gomb)
  12. {
  13. case 1: fv1();break;
  14. }
  15.  
  16.  
  17. }
  18. return 0;
  19. }
  20.  
  21. void fv1(void)
  22. {
  23. int szam=31438,db=0;
  24. while (szam>0)
  25. {
  26.  
  27. if((szam&0b1)==0b1)
  28. {
  29. db++;
  30. }
  31. szam=szam>>1;
  32. }
  33. DDRB=0xF0;
  34. DDRD=0xF0;
  35.  
  36. PORTD=(db/10%10)<<4;
  37. PORTB=(db/1%10)<<4;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement