Advertisement
tourniquet

Switch On/Off LED

Dec 16th, 2013
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. .device ATtiny2313A
  2. .nolist
  3. .include "tn2313adef.inc"
  4. .list
  5.  
  6. .def temp = R16
  7. .def temp2 = R17
  8. .def temp3 = R18
  9.  
  10. ; ***************
  11.  
  12. rjmp Init
  13.  
  14. ; ***************
  15.  
  16. Init:
  17. ser temp
  18. out DDRB, temp
  19. out PortB, temp
  20. out PortD, temp
  21.  
  22. clr temp
  23. out DDRD, temp
  24.  
  25.  
  26. ; ***************
  27.  
  28. main:
  29. sbic PinD, 0
  30. rjmp main
  31.  
  32.  
  33. sbic PinB, 0
  34. rjmp turnON
  35.  
  36. sbis PinB, 0
  37. rjmp turnOFF
  38.  
  39.  
  40. ; ***************
  41.  
  42. turnON:
  43. sbic PinB, 0
  44. cbi PortB, 0
  45.  
  46. rjmp setVar
  47.  
  48.  
  49. ; ***************
  50.  
  51. turnOFF:
  52. sbis PinB, 0
  53. sbi PortB, 0
  54.  
  55. rjmp setVar
  56.  
  57. ; ***************
  58.  
  59. setVar:
  60. ldi temp, 0xFF
  61. ldi temp2, 0xFF
  62. ldi temp3, 0x0C
  63.  
  64. loop:
  65. dec temp
  66. brne loop
  67.  
  68. loop2:
  69. dec temp2
  70. brne loop
  71.  
  72. loop3:
  73. dec temp3
  74. brne loop
  75.  
  76. rjmp main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement