LH12864CÊÇÒ»ÖÖ²ÉÓõ͹¦ºÄCMOS¼¼ÊõʵÏֵĵãÕóͼÐÎLCDÄ£¿é£¬ÄÚº¬KS0108B¿ØÖÆÆ÷£¬CSAÓëKS0108B£¨1£©Á¬Í¨£¡CSBÓëKS0108B£¨2£©Á¬Í¨£¡CSA/CSBΪ01ʱѡͨKS0108B£¨1£©£»Îª10ʱѡͨCSBÓëKS0108B£¨2£©£¬ÎªÆäËûֵʱ£¡½ûֹѡͨ£¡×ÜÏß´¦ÓÚ¸ß×è״̬£¡
LH12864C´ø×Ö¿âͼÐεãÕóÒº¾§ÆÁÏÔʾģ¿éÇý¶¯³ÌÐòÈçÏ£º
;*****************************************
; PROGRAM: LH12864C
; CONTROLLER: KS0108B
; LOW LEVEL ACTIVE
; DATE: 2005.10.06
;*****************************************
DAT EQU 20H
COM EQU 21H
DL1 EQU 22H
DL2 EQU 23H
DL3 EQU 24H
PN EQU PSW.5
E EQU P3.2
RRW EQU P3.1
DDI EQU P3.0
CS1 EQU P3.3
CS2 EQU P3.4
RES EQU P3.5
ORG 0030H
START:
CLR RES
LCALL DELAY
SETB RES
LCALL DELAY
MOV COM,#0C0H ;SET THE DISPLAY START LINE=0
ACALL WRCOM1
ACALL WRCOM2
MOV COM,#3FH ;SET DISPLAY ON
ACALL WRCOM1
ACALL WRCOM2
MAIN: MOV DPTR,#DISP1 ;WRITE THE DISPLAY CONTENT OF DISP1
MOV R2,#4H
loop3: CLR A
MOVC A,@A+DPTR
MOV 30H,A
INC DPTR
CLR A
MOVC A,@A+DPTR
MOV 31H,A
MOV R1,#00H ;R1 IS THE X ADDRESS
LOOP2: MOV A,R1
ANL A,#0BFH ;SET THE PAGE(X) ADDRESS
ORL A,#0B8H
MOV COM,A
ACALL WRCOM1
ACALL WRCOM2
MOV COM,#40H ;SET Y ADDRESS =0
ACALL WRCOM1
ACALL WRCOM2
MOV R0,#20H ;20H=32D, WRITE ONE PAGE
LOOP1: MOV DAT,30H
ACALL WRDAT1
ACALL WRDAT2
MOV DAT,31H
ACALL WRDAT1
ACALL WRDAT2
DJNZ R0,LOOP1
INC R1
CJNE R1,#08H,LOOP2
INC DPTR
ACALL DELAY
ACALL DELAY
DJNZ R2,LOOP3
DISP1: db 0ffh,0ffh,0aah,0aah
db 0ffh,00h,0aah, 55h
;======================================
SETB PN ;PN=1:POSITIVE, PN=0:NEGATIVE
POEM: MOV DPTR,#DISP2
MOV R2,#00H ; X ADDRESS
LOOP10:MOV R3,#00H ; Y ADDRESS
LOOP6: MOV A,R2 ;SET THE X ADDRESS OF A WORD IN IC1
ORL A,#0B8H
MOV COM,A
ACALL WRCOM1
MOV A,R3 ;SET THE Y ADDRESS OF A WORD IN IC1
ORL A,#40H
MOV COM,A
ACALL WRCOM1
MOV R0,#010H ;WRITE THE FIRST (UPPER) HALF OF A WORD
LOOP4: CLR A
MOVC A,@A+DPTR
JB PN,NEXT1
CPL A
NEXT1: MOV DAT,A
ACALL WRDAT1
INC DPTR
DJNZ R0,LOOP4
MOV A,R2 ;SET THE X ADDRESS OF A WORD(LOW PART) IN IC1
INC A
ORL A,#0B8H
MOV COM,A
ACALL WRCOM1
MOV A,R3 ;SET THE Y ADDRESS OF A WORD(LOW PART) IN IC1
ORL A,#40H
MOV COM,A
ACALL WRCOM1
MOV R0,#010H ;WRITE THE SECOND(LOW) HALF OF A WORD
LOOP5: CLR A
MOVC A,@A+DPTR
JB PN,NEXT2
CPL A
NEXT2: MOV DAT,A
ACALL WRDAT1
INC DPTR
INC R3
DJNZ R0, LOOP5
CJNE R3,#40H,LOOP6
MOV R3,#00H ; Y ADDRESS
LOOP7: MOV A,R2 ;SET THE X ADDRESS OF A WORD IN IC2
ORL A,#0B8H
MOV COM,A
ACALL WRCOM2
MOV A,R3 ;SET THE Y ADDRESS OF A WORD IN IC2
ORL A,#40H
MOV COM,A
ACALL WRCOM2
MOV R0,#010H ;WRITE THE FIRST (UPPER) HALF OF A WORD
LOOP8: CLR A
MOVC A,@A+DPTR
JB PN, NEXT3
CPL A
NEXT3: MOV DAT,A
ACALL WRDAT2
INC DPTR
DJNZ R0,LOOP8
MOV A,R2 ;SET THE X ADDRESS OF A WORD(LOW PART) IN IC2
INC A
ORL A,#0B8H
MOV COM,A
ACALL WRCOM2
MOV A,R3 ;SET THE Y ADDRESS OF A WORD(LOW PART) IN IC2
ORL A,#40H
MOV COM,A
ACALL WRCOM2
MOV R0,#010H ;WRITE THE SECOND(LOW) HALF OF A WORD
LOOP9: CLR A
MOVC A,@A+DPTR
JB PN,NEXT4
CPL A
NEXT4: MOV DAT,A
ACALL WRDAT2
INC DPTR
INC R3
DJNZ R0, LOOP9
CJNE R3,#40H,LOOP7
INC R2
INC R2
MOV A,R2
XRL A,#08H
JZ NEXT5
AJMP LOOP10
NEXT5: ACALL DELAY
ACALL DELAY
ACALL DELAY
; CPL PN ;POS., NEG. ALTER MODE
; AJMP POEM
ljmp MAIN
SJMP $
;***********SUBROUTINE*******************
;------------WRITE DATA TO IC1-----------
WRDAT1: PUSH ACC
SETB CS1 ;OPEN IC1, CLOSE IC2
CLR CS2
; SETB rrw ;READ THE STATUS WORD
; CLR DDI
WD1: MOV P1,#0FFH
; SETB E
; MOV A,P1
; CLR E
; JB ACC.7,WD1 ;BUSY?
SETB DDI
CLR rrw
MOV P1,DAT
SETB E ;FALLING EDGE OF E
NOP
CLR E
POP ACC
RET
;------------WRITE COMMAND TO IC1-----------
WRCOM1: PUSH ACC
SETB CS1 ;OPEN IC1, CLOSE IC2
CLR CS2
SETB rrw ;READ THE STATUS WORD
CLR DDI
WC1: MOV P1,#0FFH
SETB E
MOV A,P1
CLR E
JB ACC.7,WC1 ;BUSY?
CLR rrw
MOV P1,COM
SETB E ;FALLING EDGE OF E
NOP
CLR E
POP ACC
RET
;---------------READ DATA FROM IC1----------
RDDAT1: PUSH ACC
SETB CS1 ;OPEN IC1, CLOSE IC2
CLR CS2
SETB rrw ;READ THE STATUS WORD
CLR DDI
RD1: MOV P0,#0FFH
SETB E
MOV A,P1
CLR E
JB ACC.7,RD1 ;BUSY?
SETB DDI
MOV P1, #0FFH
SETB E
MOV DAT,P1
CLR E
POP ACC
RET
;------------WRITE DATA TO IC2-----------
WRDAT2: PUSH ACC
SETB CS2 ;OPEN IC2, CLOSE IC1
CLR CS1
SETB rrw ;READ THE STATUS WORD
CLR DDI
WD2: MOV P1,#0FFH
SETB E
MOV A,P1
CLR E
JB ACC.7,WD2 ;BUSY?
SETB DDI
CLR rrw
MOV P1,DAT
SETB E ;FALLING EDGE OF E
NOP
CLR E
POP ACC
RET
;------------WRITE COMMAND TO IC1-----------
WRCOM2: PUSH ACC
SETB CS2 ;OPEN IC2, CLOSE IC1
CLR CS1
SETB rrw ;READ THE STATUS WORD
CLR DDI
WC2: MOV P1,#0FFH
SETB E
MOV A,P1
CLR E
JB ACC.7,WC2 ;BUSY?
CLR rrw
MOV P1,COM
SETB E ;FALLING EDGE OF E
NOP
CLR E
POP ACC
RET
;---------------READ DATA FROM IC1----------
RDDAT2: PUSH ACC
SETB CS2 ;OPEN IC2, CLOSE IC1
CLR CS1
SETB rrw ;READ THE STATUS WORD
CLR DDI
RD2: MOV P1,#0FFH
SETB E
MOV A,P1
CLR E
JB ACC.7,RD2 ;BUSY?
SETB DDI
MOV P1, #0FFH
SETB E
MOV DAT,P1
CLR E
POP ACC
RET
;----------------DELAY----------------
DELAY: MOV DL3,#03H
DLY2: MOV DL1,#08AH
MOV DL2,#0FEH
DLY1: NOP
DJNZ DL2,DLY1
DJNZ DL1,DLY1
DJNZ DL3,DLY2
RET
;*******************************************************
disp2: db 010h, 022h, 064h, 0ch, 0c0h, 044h, 054h, 054h
db 054h, 07fh, 054h, 054h, 0d6h, 044h, 040h, 00h
db 04h, 04h, 0feh, 01h, 00h, 00h, 0ffh, 015h
db 015h, 015h, 055h, 095h, 07fh, 01h, 00h, 00h
db 00h, 0fch, 044h, 044h, 044h, 0feh, 04h, 00h
db 0feh, 022h, 022h, 022h, 022h, 0ffh, 02h, 00h
db 00h, 0fh, 04h, 04h, 04h, 08fh, 040h, 030h
db 0fh, 02h, 02h, 042h, 082h, 07fh, 00h, 00h
db 00h, 0fch, 084h, 084h, 084h, 0feh, 014h, 010h
db 090h, 010h, 010h, 010h, 0ffh, 010h, 010h, 00h
db 00h, 03fh, 010h, 010h, 010h, 03fh, 00h, 00h
db 00h, 023h, 040h, 080h, 07fh, 00h, 00h, 00h
db 04h, 024h, 024h, 024h, 024h, 03fh, 0e4h, 024h
db 024h, 03fh, 024h, 024h, 0f4h, 026h, 04h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 0ffh, 00h
db 00h, 04h, 08h, 010h, 0fh, 00h, 00h, 00h
db 02h, 02h, 0f2h, 012h, 092h, 012h, 012h, 0feh
db 012h, 092h, 012h, 012h, 0fah, 013h, 02h, 00h
db 00h, 00h, 0ffh, 00h, 08h, 011h, 00h, 07fh
db 00h, 08h, 051h, 080h, 07fh, 00h, 00h, 00h
db 020h, 030h, 0ach, 063h, 030h, 00h, 080h, 060h
db 01eh, 00h, 07h, 018h, 060h, 0c0h, 040h, 00h
db 022h, 067h, 022h, 012h, 012h, 081h, 040h, 031h
db 0fh, 01h, 041h, 081h, 07fh, 00h, 00h, 00h
db 020h, 030h, 0ach, 063h, 030h, 00h, 080h, 060h
db 01eh, 00h, 07h, 018h, 060h, 0c0h, 040h, 00h
db 022h, 067h, 022h, 012h, 012h, 081h, 040h, 031h
db 0fh, 01h, 041h, 081h, 07fh, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 00h, 00h, 020h, 01ch, 0ch, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 00h, 0feh, 042h, 0c2h, 042h, 07fh, 012h, 08h
db 08ch, 057h, 024h, 054h, 08ch, 084h, 080h, 00h
db 040h, 07eh, 040h, 03fh, 022h, 022h, 01h, 0ffh
db 042h, 042h, 042h, 042h, 042h, 0ffh, 02h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 0ffh
db 020h, 020h, 020h, 030h, 020h, 00h, 00h, 00h
db 040h, 040h, 040h, 040h, 040h, 040h, 040h, 07fh
db 040h, 040h, 040h, 040h, 040h, 060h, 040h, 00h
db 00h, 010h, 088h, 0c4h, 023h, 040h, 042h, 042h
db 042h, 042h, 042h, 0c2h, 043h, 062h, 040h, 00h
db 02h, 01h, 00h, 0ffh, 00h, 00h, 00h, 00h
db 00h, 040h, 080h, 07fh, 00h, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 080h, 07fh
db 080h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 00h, 080h, 040h, 020h, 010h, 0ch, 03h, 00h
db 03h, 0ch, 010h, 020h, 040h, 0c0h, 040h, 00h
db 088h, 044h, 023h, 018h, 023h, 044h, 0c8h, 020h
db 010h, 0fh, 0e8h, 08h, 028h, 018h, 00h, 00h
db 00h, 07fh, 021h, 021h, 021h, 07fh, 080h, 040h
db 030h, 0ch, 03h, 01ch, 060h, 0c0h, 040h, 00h
db 00h, 0feh, 044h, 048h, 050h, 0ffh, 050h, 048h
db 04h, 0fch, 044h, 044h, 0c2h, 062h, 040h, 00h
db 00h, 07fh, 024h, 022h, 021h, 03fh, 021h, 0a2h
db 040h, 03fh, 00h, 00h, 0ffh, 00h, 00h, 00h
db 020h, 024h, 0e4h, 026h, 034h, 020h, 0fch, 026h
db 025h, 0fch, 024h, 024h, 0feh, 04h, 00h, 00h
db 08h, 0eh, 09h, 08h, 08ch, 058h, 023h, 019h
db 07h, 07dh, 081h, 0b1h, 0adh, 0b0h, 0c0h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 00h, 030h, 048h, 048h, 030h, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 080h, 040h, 020h, 0f8h, 047h, 048h, 048h, 07fh
db 048h, 048h, 048h, 07fh, 0c8h, 068h, 040h, 00h
db 00h, 00h, 00h, 0ffh, 00h, 00h, 0ffh, 049h
db 049h, 049h, 049h, 049h, 0ffh, 01h, 00h, 00h
db 00h, 0f8h, 01h, 02h, 0e6h, 020h, 022h, 022h
db 022h, 022h, 0f2h, 022h, 02h, 0ffh, 02h, 00h
db 00h, 0ffh, 00h, 00h, 01fh, 08h, 08h, 08h
db 08h, 08h, 01fh, 040h, 080h, 07fh, 00h, 00h
db 010h, 021h, 066h, 00h, 082h, 0f2h, 012h, 012h
db 0feh, 012h, 0feh, 012h, 012h, 0fbh, 012h, 00h
db 04h, 04h, 0feh, 01h, 00h, 0ffh, 042h, 049h
db 048h, 048h, 048h, 049h, 041h, 0ffh, 00h, 00h
db 010h, 0ch, 024h, 0a4h, 0a4h, 064h, 0a5h, 026h
db 024h, 024h, 024h, 0a4h, 024h, 014h, 0ch, 00h
db 00h, 049h, 049h, 024h, 024h, 052h, 089h, 07fh
db 04h, 0ah, 011h, 011h, 020h, 060h, 020h, 00h
db 080h, 040h, 020h, 0f8h, 07h, 04h, 0e4h, 024h
db 024h, 0f4h, 024h, 04h, 0fch, 06h, 04h, 00h
db 00h, 00h, 00h, 0ffh, 00h, 00h, 0fh, 04h
db 04h, 0fh, 040h, 080h, 07fh, 00h, 00h, 00h
db 00h, 00h, 0e0h, 01eh, 010h, 010h, 0f0h, 00h
db 00h, 0ffh, 020h, 040h, 080h, 080h, 00h, 00h
db 082h, 041h, 020h, 01bh, 04h, 01bh, 020h, 040h
db 040h, 05fh, 040h, 040h, 040h, 061h, 020h, 00h
db 04h, 04h, 04h, 084h, 0e4h, 03ch, 027h, 024h
db 024h, 024h, 024h, 0f4h, 024h, 06h, 04h, 00h
db 04h, 02h, 01h, 00h, 0ffh, 09h, 09h, 09h
db 09h, 049h, 089h, 07fh, 00h, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 00h, 00h, 020h, 01ch, 0ch, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 040h, 03ch, 010h, 010h, 0ffh, 010h, 050h, 020h
db 0d8h, 017h, 010h, 010h, 0f0h, 018h, 010h, 00h
db 04h, 04h, 04h, 02h, 0ffh, 081h, 081h, 040h
db 023h, 014h, 08h, 016h, 061h, 0c0h, 040h, 00h
db 020h, 020h, 024h, 0a4h, 0ach, 0b4h, 0a5h, 0a6h
db 0a4h, 0b4h, 0ach, 0e6h, 0a4h, 030h, 020h, 00h
db 00h, 080h, 0a0h, 0afh, 0aah, 0aah, 0aah, 0ffh
db 0aah, 0aah, 0aah, 0afh, 0a0h, 080h, 00h, 00h
db 040h, 042h, 044h, 0cch, 00h, 042h, 036h, 02ah
db 022h, 0feh, 021h, 029h, 025h, 080h, 00h, 00h
db 00h, 040h, 020h, 01fh, 021h, 041h, 05dh, 049h
db 049h, 04fh, 049h, 049h, 05dh, 061h, 021h, 00h
db 010h, 010h, 010h, 0ffh, 090h, 050h, 00h, 03fh
db 048h, 048h, 048h, 044h, 046h, 0c4h, 070h, 00h
db 02h, 042h, 081h, 07fh, 00h, 00h, 00h, 0ffh
db 049h, 049h, 049h, 049h, 049h, 0ffh, 01h, 00h
db 08h, 08h, 088h, 088h, 048h, 028h, 018h, 0ffh
db 018h, 028h, 048h, 048h, 088h, 08ch, 088h, 00h
db 01h, 01h, 00h, 0feh, 042h, 042h, 042h, 043h
db 042h, 042h, 042h, 0feh, 00h, 01h, 00h, 00h
db 04h, 04h, 04h, 0c4h, 03fh, 04h, 04h, 04h
db 0e4h, 04h, 01fh, 084h, 0c4h, 06h, 04h, 00h
db 04h, 02h, 01h, 0ffh, 00h, 020h, 010h, 08h
db 03fh, 042h, 041h, 040h, 040h, 040h, 070h, 00h
db 010h, 010h, 0d0h, 0ffh, 090h, 018h, 010h, 010h
db 090h, 010h, 010h, 0ffh, 010h, 018h, 010h, 00h
db 04h, 03h, 00h, 0ffh, 00h, 03h, 00h, 00h
db 00h, 043h, 080h, 07fh, 00h, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 00h, 030h, 048h, 048h, 030h, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
end
LH12864C²úÆ·×ÊÁÏÐÅÏ¢¿ÉÒÔ·ÃÎÊÍøÖ·£º
http://www.lcdlh.com/danse/COB/12864/95.html
Ïà¹Ø²úÆ·ÍƼö£º
> lcd12864²úÆ·Ñ¡ÐÍ