SHARE
TWEET

Untitled

a guest Jun 18th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. LJMP START
  2. P5 EQU 0F8H
  3. P7 EQU 0DBH
  4. LCDstatus equ 0FF2EH
  5. LCDcontrol equ 0FF2CH
  6. LCDdataWR equ 0FF2DH
  7.  
  8. #define HOME         0x80
  9. #define INITDISP    0x38
  10. #define HOM2        0xc0
  11. #define LCDON         0x0e
  12. #define CLEAR        0x01
  13.  
  14. ORG 000BH
  15. MOV TH0, #00H
  16. MOV TL0, #00H
  17. DEC R0
  18. RETI
  19.  
  20. ORG 0100H
  21. fun:
  22. MOV DPH, #80H
  23. MOV DPL, #01H
  24. MOV A, #031H
  25. MOVX @DPTR , A
  26.  
  27. MOV DPL, #02H
  28. MOV A, #032H
  29. MOVX @DPTR , A
  30.  
  31. MOV DPL, #03H
  32. MOV A, #033H
  33. MOVX @DPTR , A
  34.  
  35. MOV DPL, #04H
  36. MOV A, #034H
  37. MOVX @DPTR , A
  38.  
  39. MOV DPL, #05H
  40. MOV A, #035H
  41. MOVX @DPTR , A
  42.  
  43. MOV DPL, #06H
  44. MOV A, #036H
  45. MOVX @DPTR , A
  46.  
  47. MOV DPL, #07H
  48. MOV A, #037H
  49. MOVX @DPTR , A
  50.  
  51. MOV DPL, #08H
  52. MOV A, #038H
  53. MOVX @DPTR , A
  54.  
  55. MOV DPL, #09H
  56. MOV A, #039H
  57. MOVX @DPTR , A
  58.  
  59. MOV DPL, #00H
  60. MOV A, #030H
  61. MOVX @DPTR , A
  62.  
  63. MOV DPL, #0AH
  64. MOV A, #03AH
  65. MOVX @DPTR , A
  66. RET
  67.  
  68. LCDcntrlWR MACRO x
  69.             LOCAL loop
  70. loop:MOV DPTR, #LCDstatus
  71.         MOVX A,@DPTR
  72.         JB ACC.7,loop
  73.  
  74.         MOV DPTR,#LCDcontrol
  75.         MOV A, x
  76.         MOVX @DPTR, A
  77.         ENDM
  78.        
  79. LCDcharWR MACRO
  80.         LOCAL tutu
  81.         PUSH ACC
  82. tutu:    MOV DPTR, #LCDstatus
  83.         MOVX A,@DPTR
  84.         JB ACC.7, tutu
  85.  
  86.         MOV DPTR,#LCDdataWR
  87.         POP ACC
  88.         MOVX @DPTR, A
  89.         ENDM
  90.  
  91. init_LCD MACRO
  92.         LCDcntrlWR #INITDISP
  93.         LCDcntrlWR #CLEAR
  94.         LCDcntrlWR #LCDON
  95.         ENDM
  96. newline:
  97. DJNZ R5, koniec
  98. LCDcntrlWR #HOM2
  99. MOV R5,  #010H
  100. koniec:
  101. ret
  102.  
  103. clearlcd:
  104. DJNZ R6, konieclcd
  105. LCDcntrlWR #CLEAR
  106. LCDcntrlWR #HOME
  107. MOV R6,  #020H
  108. konieclcd:
  109. ret
  110.  
  111.  
  112.  
  113. update:
  114. inc R1
  115. cjne r1, #0AH, h
  116. MOV R1, #00H
  117. inc R2
  118. cjne R2, #06H, h
  119. MOV R2, #00H
  120. inc R3
  121. cjne R3, #0AH, h
  122. MOV R3, #00H
  123. inc R4
  124. cjne R4, #06H, h
  125. MOV R4, #00H
  126. h:
  127. ret
  128.  
  129. print:
  130.     LCDcntrlWR #CLEAR
  131. LCDcntrlWR #HOME
  132.     MOV DPH, #80H
  133.     MOV DPL, R4
  134.     MOVX A, @DPTR
  135.     LCDcharWR
  136.     MOV DPH, #80H
  137.     MOV DPL, R3
  138.     MOVX A, @DPTR
  139.     LCDcharWR
  140.  
  141.     MOV DPH, #80H
  142.     MOV DPL, #0AH
  143.     MOVX A, @DPTR
  144.     LCDcharWR
  145.  
  146.     MOV DPH, #80H
  147.     MOV DPL, R2
  148.     MOVX A, @DPTR
  149.     LCDcharWR
  150.     MOV DPH, #80H
  151.     MOV DPL, R1
  152.     MOVX A, @DPTR
  153.     LCDcharWR
  154. ret
  155. START:
  156.     init_LCD
  157.     call fun
  158.     MOV R1, #0H
  159.     MOV R2, #0H
  160.     MOV R3, #0H
  161.     MOV R4, #0H
  162.     MOV TMOD, #01H
  163.     MOV TH0, #00H
  164.     MOV TL0, #00H
  165.     SETB TR0
  166.     MOV IE, #82H
  167.     MOV A, #00H
  168.     MOV P1, A
  169. DALEJ: MOV R0, #0FH
  170.    
  171.  
  172.  
  173. CZEKAM:
  174.     MOV R5, #01111111B
  175. MOV A, R5
  176. MOV P5, B
  177. MOV A, P7
  178. ANL A, R5
  179. CLR C
  180. SUBB A,R5
  181. JZ CZEKAM2
  182. MOV R1, #0H
  183. MOV R2, #0H
  184. MOV R3, #0H
  185. MOV R4, #0H
  186. CALL print
  187. CZEKAM2:
  188.     MOV A, R0
  189.     JNZ CZEKAM
  190.     MOV A, P1
  191.     CPL A
  192.     MOV P1, A
  193.     CALL update
  194.     CALL print
  195.     JMP DALEJ
  196.  
  197. NOP
  198. NOP
  199. NOP
  200. JMP $
  201. END START
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top