Guest User

Untitled

a guest
May 22nd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1.  
  2. list p=16f84a
  3. #include p16f84a.inc
  4.  
  5. msek equ 0Ch
  6. TMP equ 0Dh
  7. adres equ 0Eh
  8. porta equ 0x05
  9. portb equ 0x06
  10. TRISA equ 0x85
  11. TRISB equ 0x86
  12. status equ 0x03
  13. RP0 equ 5
  14.  
  15. #define E porta,1
  16. #define RS porta,0
  17. org 0
  18. goto start
  19.  
  20.  
  21.  
  22.  
  23. wys_strona
  24. movlw 0
  25. movwf adres
  26. et_wys call strona
  27. call 0
  28. bcfss 2
  29. return
  30.  
  31. strona movfw 80h
  32. call wrcmd
  33. movfw 'K'
  34. call wrdata
  35. movlw 'r'
  36. call wrdata
  37. return
  38.  
  39. delay_100
  40. movwf msek
  41. bsf status,RP0
  42. movlw b'00000100'
  43. et_del_1
  44. bcf status, RP0
  45. clrf TMR0
  46. et_del_2
  47. movlw d'100'
  48. bcf status, RP0
  49. subwf TMR0,W
  50. btfss C,5
  51. goto et_del_2
  52. decfsz msek,f
  53. goto et_del_1
  54. return
  55.  
  56. iniLCD movlw .50
  57. call delay_msek
  58. BCF RS
  59. BSF E
  60. movlw b'00000011'
  61. movwf PORTB
  62. bcf E
  63. movlw .5
  64. call delay_msek
  65. bsf E
  66. nop
  67. nop
  68. bcf E
  69. call delay_100
  70. bsf E
  71. nop
  72. nop
  73. bcf E
  74. call delay_100
  75. movlw b'00101000'
  76. call wrcmd
  77. movlw b'00001000'
  78. call wrcmd
  79. movlw b'00000001'
  80. call wrcmd
  81. movlw b'00000110'
  82. call wrcmd
  83. movlw b'11000000'
  84. call wrcmd
  85. return
  86.  
  87.  
  88. wrdata bsf RS
  89. goto at_write
  90. wrcmd bcf RS
  91.  
  92. at_write
  93. movwf TMP
  94. bsf E
  95. swapf TMP,f
  96. movlw 0f0h
  97. iorwf TMP ,w
  98. movlw w ,PORTB
  99. bcf E
  100. nop
  101. nop
  102. bsf E
  103. swapf TMP,w
  104. iorwf 0f0h
  105. movwf PORTB
  106. bcf E
  107. btfsc RS
  108. goto at_data
  109. movlw .2
  110. call delay_msek
  111. return
  112. at_data
  113. call delay_100
  114. return
  115.  
  116.  
  117.  
  118. delay_msek
  119.  
  120. movwf msek
  121. bsf status,RP0
  122. movlw b'00000100'
  123. et_delay_1
  124. bcf status, RP0
  125. clrf TMR0
  126. et_delay_2
  127. movlw d'200'
  128. bcf status, RP0
  129. subwf TMR0,W
  130. btfss C,5
  131. goto et_delay_2
  132. decfsz msek,f
  133. goto et_delay_1
  134. return
  135.  
  136.  
  137.  
  138. start
  139.  
  140.  
  141. bsf RP0,5
  142. movfw b'11110000'
  143. movwf TRISB
  144. movwf TRISA
  145. bcf RP0,5
  146. call iniLCD
  147. movfw 80h
  148. call wrcmd
  149. call wys_strona
  150. movlw 0Ch
  151. call wrcmd
  152. end
Add Comment
Please, Sign In to add comment