;--------液晶LCD-162通信子程序及用法----------
;----------------------------------------------
DISPWLL
CLRF RD
MOVLW B'01000000'
MOVWF TRISC
MOVLW 0FFH
MOVWF TRISD
BCF RC,RS3
BSF RC,RW3
BSF RC,E
MOVF RD,W
MOVWF BUFFER
BTFSC BUFFER,7
GOTO DISPWLL2
CLRWDT
BCF RC,E
BCF RC,RW3
BSF RC,E
BCF RC,RS3
BCF RC,RW3
GOTO DISPW
DISPWHL
CLRF RD
MOVLW B'01000000'
MOVWF TRISC
MOVLW 0FFH
MOVWF TRISD
BCF RC,RS3
BSF RC,RW3
BSF RC,E
MOVF RD,W
MOVWF BUFFER
BTFSC BUFFER,7
GOTO DISPWHL2
CLRWDT
BCF RC,E
BCF RC,RW3
BSF RC,E
BCF RC,RS3
BSF RC,RS3
BCF RC,RW3
DISPW
MOVLW 0
MOVWF TRISD
BCF RC,RW3
BSF RC,E
MOVF DATA3,W
MOVWF RD
BCF RC,E
NOP
BSF RC,RW3
BSF RC,E
BCF RC,E
RETLW 0
;------------------------------
;******************************
; 实际用法
;------------------------------
; 芯片复位程序
;------------------------------
DISPSTART
MOVLW B'00110000'
MOVWF DATA3
CALL DISPWLL
CALL DELAY
MOVLW B'00110000'
MOVWF DATA3
CALL DISPWLL
CALL DELAY
MOVLW B'00110000'
MOVWF DATA3
CALL DISPWLL
MOVLW B'00111000'
MOVWF DATA3
CALL DISPWLL
MOVLW B'00001000'
MOVWF DATA3
CALL DISPWLL
MOVLW B'00000001'
MOVWF DATA3
CALL DISPWLL
MOVLW B'00000111'
MOVWF DATA3
CALL DISPWLL
;------------------
CALL DISPS
MOVLW B'00000001'
MOVWF DATA3
CALL DISPWLL
CALL WELCOME
;---------------------------- DISPLAY SATUP
; 显示模式设置
;----------------------------
DISPS
MOVLW B'00111000'
MOVWF DATA3
CALL DISPWLL
MOVLW B'00001100'
MOVWF DATA3
CALL DISPWLL
MOVLW B'00000110'
MOVWF DATA3
CALL DISPWLL
RETLW 0
;----------------------------
; 显示'WELCOME'程序
;------------------------------
WELCOME
MOVLW D'0' ; WELCOME TO USE
MOVWF LBYTE
MOVLW D'14'
MOVWF COUNT9
MOVLW 0C3H
MOVWF DATA3
CALL DISPWLL
CALL CABIAO
RETLW 0
;------------------------
CABIAO
BSF STATUS,RP0
MOVLW 2FH
MOVWF 81H
BCF STATUS,RP0
MOVF LBYTE,W
CALL TABLE0
MOVWF DATA3
CLRWDT
CALL DISPWHL
INCF LBYTE,1
DECFSZ COUNT9,1
GOTO CABIAO
RETLW 0
;-------------------------
;******************************
ORG 0100H
;******************************
TABLE0
ADDWF PCL,1
RETLW 57H ;WELCOME TO USE
RETLW 45H
RETLW 4CH
RETLW 43H
RETLW 4FH
RETLW 4DH
RETLW 45H
RETLW 20H
RETLW 54H
RETLW 4FH
RETLW 20H
RETLW 55H
RETLW 53H
RETLW 45H ;46
;-----------------------------
END