HT1621LCD驱动 PIC单片机

STATUSEQU3H
FSREQU4H
RBEQU6H
RCEQU7H
OPTIONAEQU81H
TRISBEQU86H
TRISCEQU87H

GENR0EQU053H
GENR1EQU054H
WD_RGEQU055H
DA_AG0EQU056H;SEG0SEG1
DA_AG8EQU05EH;SEG16SEG17
;.............................
CEQU0
ZEQU2
RP0EQU5
RP1EQU6
CSEQU2
WDAEQU5;RC,5数据线
WCLKEQU1;RB,1写时钟线
RCLKEQU4;RB,4读时钟线
;..............................
ORG0H
GOTOSTART
;...............................
STARTBSFSTATUS,RP0
MOV LW00H
MOV WFTRISB
MOV LW81H
MOV WFTRISC
BCFSTATUS,RP0
MOV LW12H
MOV WFRB
BSFRC,2
BSFRC,5
MOV LW4
MOV WFOPTIONA
LOOPNOP
CALLX_QUAN
NOP
GOTOLOOP

;............................
X_QUAN
MOV LW8H
CALLON_LCD;TRANSMITTH1621WORKMODEVALUE

MOV LW9H;显示9位LCD
CALLDIS_DATA

RETURN
;............................
ON_LCD MOV WFGENR1
BCFRC,2
MOV LW80H;HI_W3BITS:100
MOV WFWD_RG
MOV LW3;3位命令100
CALLTRAM_DATA
ON_LCD0 MOV FGENR1,0
CALLON_VALUE;查表初始化LCD
MOV WFWD_RG

MOV LW8;送8位查表值
CALLTRAM_DATA

BCFRC,WDA
NOP
NOP
BCFRB,1
NOP
NOP
BSFRB,1
BSFRC,2
DECFSZGENR1,1
GOTOON_LCD+1
RETURN
;........................
ON_VALUE
ADDWF2
NOP
RETLW03H;LCDON
RETLW01H;SYSON

RETLW08H;TONEOFF
RETLW29H;BISA1/34COM
RETLW18H;256K
RETLW05H;WDTDISABLE

RETLW80H;/IRQDISABLE*
RETLW0E3H;NORMALMODE*

;................................
;TRANSMITBITSSUBROUTINE
TRAM_DATA
BCFSTATUS,0
MOV WFGENR0
BCFRB,1
RLFWD_RG
BTFSS3,0
GOTO$+3
BSFRC,WDA
GOTO$+2
BCFRC,WDA

BSFRB,1
DECFSZGENR0,1
GOTOTRAM_DATA+2

RETURN
;.......................
DIS_DATA
MOV WFGENR1;9位LCD
BCFRC,2
MOV LW0A0H
MOV WFWD_RG;WRITECONTROL

MOV LW3H;3位写命令101
CALLTRAM_DATA
MOV LW00
MOV WFWD_RG;WRITEADDRESS
MOV LW6H;6位地址
CALLTRAM_DATA;
DIS_DATA0

MOV LW0FFH
MOV WFWD_RG;DISPLAYCODE

MOV LW8;8段数据
CALLTRAM_DATA

DECFSZGENR1,1
GOTODIS_DATA0
BSFRC,2
RETLW0
END
【HT1621LCD驱动 PIC单片机】

    推荐阅读