Advertisement
Guest User

pidor

a guest
Apr 22nd, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <hidef.h> /* common defines and macros */
  2. #include "derivative.h" /* derivative-specific definitions */
  3.  
  4.  
  5.  
  6. unsigned int CHECK = 0;
  7. unsigned int DIRECT = 0;
  8. unsigned int b = 0;
  9. unsigned int DIR = 0;
  10. unsigned int bit_0 = 0;
  11. unsigned int bit_1 = 0;
  12. unsigned int bit_2 = 0;
  13. unsigned int bit_3 = 0;
  14.  
  15. unsigned int bits4 = 0;
  16.  
  17. void main()
  18. {
  19. DDRP = 0xF0;
  20. DDRB = 0xF0;
  21.  
  22. PUCR |= 0x02;
  23.  
  24. TSCR2 = 0x83;
  25. DIRECT=12536;
  26. TSCR1 = 0x80;
  27. PORTB = 0xFF;
  28.  
  29. EnableInterrupts;
  30. for (;;)
  31. {}
  32. }
  33.  
  34. interrupt 16 void TOF()
  35. {
  36. TFLG2 = 0x80;
  37. CHECK=PORTAB;
  38. bit_0 = (PORTAB & 1) << 3;
  39. bit_1 = (PORTAB & 2) << 1;
  40. bit_2 = (PORTAB & 4) >> 1;
  41. bit_3 = (PORTAB & 8) >> 3;
  42.  
  43. bits4 = bit_3 + bit_2 + bit_1 + bit_0;
  44. PORTB = bits4 << 4;
  45.  
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement