专注单片机方案开发的深圳金沙js5线路分享LCD驱动HT1621的PIC单片机源代码。
STATUS EQU 3H
FSR EQU 4H
RB EQU 6H
RC EQU 7H
OPTIONA EQU 81H
TRISB EQU 86H
TRISC EQU 87H
GENR0 EQU 053H
GENR1 EQU 054H
WD_RG EQU 055H
DA_AG0 EQU 056H ;SEG0 SEG1
DA_AG8 EQU 05EH ;SEG16 SEG17
;.............................
C EQU 0
Z EQU 2
RP0 EQU 5
RP1 EQU 6
CS EQU 2
WDA EQU 5 ;RC,5数据线
WCLK EQU 1 ;RB,1写时钟线
RCLK EQU 4 ;RB,4读时钟线
;..............................
ORG 0H
GOTO START
;...............................
START BSF STATUS,RP0
MOVLW 00H
MOVWF TRISB
MOVLW 81H
MOVWF TRISC
BCF STATUS,RP0
MOVLW 12H
MOVWF RB
BSF RC,2
BSF RC,5
MOVLW 4
MOVWF OPTIONA
LOOP NOP
CALL X_QUAN
NOP
GOTO LOOP
;............................
X_QUAN
MOVLW 8H
CALL ON_LCD ;TRANSMIT TH1621 WORK MODE VALUE
MOVLW 9H ;显示9位LCD
CALL DIS_DATA
RETURN
;............................
ON_LCD MOVWF GENR1
BCF RC,2
MOVLW 80H ;HI_W3 BITS:100
MOVWF WD_RG
MOVLW 3 ;3位命令100
CALL TRAM_DATA
ON_LCD0 MOVF GENR1,0
CALL ON_VALUE ;查表初始化LCD
MOVWF WD_RG
MOVLW 8 ;送8位查表值
CALL TRAM_DATA
BCF RC,WDA
NOP
NOP
BCF RB,1
NOP
NOP
BSF RB,1
BSF RC,2
DECFSZ GENR1,1
GOTO ON_LCD+1
RETURN
;........................
ON_VALUE
ADDWF 2
NOP
RETLW 03H ;LCD ON
RETLW 01H ;SYS ON
RETLW 08H ;TONE OFF
RETLW 29H ;BISA1/3 4 COM
RETLW 18H ;256K
RETLW 05H ;WDT DISABLE
RETLW 80H ;/IRQ DISABLE *
RETLW 0E3H ;NORMAL MODE *
;................................
;TRANSMIT BITS SUBROUTINE
TRAM_DATA
BCF STATUS,0
MOVWF GENR0
BCF RB,1
RLF WD_RG
BTFSS 3,0
GOTO