Advertisement
gabrielaozegovic

2 ledice, svaka svoja frekvencija

Dec 12th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. .def tmp = r16
  2. .def mask1 = r17
  3. .def mask2 = r18
  4. .def counter = r20
  5.  
  6. .cseg
  7. rjmp reset
  8.  
  9. .org $00C
  10. rjmp t1
  11.  
  12. .org $026
  13. rjmp t0
  14.  
  15. reset:
  16. ldi tmp, high(RAMEND)
  17. out SPH, tmp
  18. ldi tmp, low(RAMEND)
  19. out SPL, tmp
  20.  
  21. ldi tmp, 0xff
  22. out DDRA, tmp
  23. out PORTA, tmp
  24.  
  25. ldi tmp, (1 << WGM12) | (1 << CS10) | (1 << CS11)
  26. out TCCR1B, tmp
  27.  
  28. ldi tmp, (1 << WGM01) | (1 << CS02)
  29. out TCCR0, tmp
  30.  
  31. ldi tmp, high(28799)
  32. out OCR1AH, tmp
  33. ldi tmp, low(28799)
  34. out OCR1AL, tmp
  35.  
  36. ldi tmp, 72
  37. out OCR0, tmp
  38.  
  39. ldi tmp, (1 << OCIE1A) | (1 << OCIE0)
  40. out TIMSK, tmp
  41.  
  42. sei
  43.  
  44. ldi tmp, 0xff
  45. ldi mask1, 0x01
  46. ldi mask2, 0x80
  47.  
  48. main:
  49. rjmp main
  50.  
  51.  
  52. t1:
  53. eor tmp, mask1
  54. out PORTA, tmp
  55.  
  56. reti
  57.  
  58.  
  59. t0:
  60. inc counter
  61.  
  62. cpi counter, 200
  63. brne t0_jump
  64. eor tmp, mask2
  65. ldi counter, 0
  66. out PORTA, tmp
  67. t0_jump:
  68. reti
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement