Advertisement
Tenac451

Untitled

Nov 11th, 2020 (edited)
617
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. dseg at 0030h
  2.  
  3. counter_1s : ds 1
  4. blinky : ds 1
  5. counter_lcd: ds 1
  6.  
  7. cseg at 8200h
  8.  
  9. ; move stack pointer to upper half of internal memory
  10. mov sp, 080h
  11.  
  12. ; configure timer T0
  13. ; gate = 0 (always active, not only during interrupt)
  14. ; C/T = 0 (use internal counter from system clock)
  15. ; mode = 01 (16 bit, no auto reload)
  16. ; lower half of TMOD: 0001b=1h
  17. mov A, TMOD
  18. anl A, #0F1h ; TMOD & (1111 0000)
  19. orl A, #01h
  20. mov TMOD, A
  21.  
  22. ; enable timer interrupts
  23. setb ET0
  24. setb EA
  25.  
  26. ; output value
  27. ; used for blinking LED on P6
  28. mov blinky, #00h
  29.  
  30. ; init counter value
  31. mov counter_1s, #00h
  32.  
  33. ; start timer
  34. setb TR0
  35.  
  36. mov A, #00h
  37. LCALL 1000h
  38. mov A, #01h
  39. LCALL 1000h
  40. mov counter_lcd, #00h
  41.  
  42.  
  43.  
  44. MAIN:
  45. mov 0FAh, blinky
  46. ; check if 1s has passed (20x50ms)
  47. mov R0, counter_1s
  48. cjne R0, #14h, MAIN
  49. mov counter_1s, #00h
  50. ; invert lowest bit of blinky
  51. mov A, blinky
  52. xrl A, #01h
  53. mov blinky, A
  54. sjmp LCD
  55.  
  56.  
  57. LCD:
  58. inc counter_lcd
  59.  
  60. mov R0, counter_lcd
  61. mov R1, #01h
  62. mov A, #18h
  63. LCALL 1000h
  64. ;Curser Position
  65. mov R0, #01h
  66. mov R1, #02h
  67. mov A, #02h
  68. LCALL 1000h
  69. ; zahl Schreiben
  70.  
  71. mov R0, counter_lcd
  72. mov A, #015h
  73. LCALL 1000h
  74. ;Bar
  75. sjmp MAIN
  76.  
  77.  
  78.  
  79. cseg at 800Bh
  80. clr TR0
  81. mov TL0, #0B0h
  82. mov TH0, #03Ch
  83. inc counter_1s
  84. ;setb 20h
  85. setb TR0
  86. RETI
  87.  
  88. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement