12832MP3液晶显示屏的驱动程序

程序匠人 发表于 2005-11-7 17:36:00  阅读全文(1349) | 回复(0) | 引用通告(0) | 编辑

12832MP3液晶显示屏的驱动程序

液晶显示屏主要是靠显示一个个小的点来达到显示数字或图像的目的。
而其显示程序主要要注意写好其驱动程序,驱动程序的
有些命令的延时时间长短要注意。
另外发送数据或者命令时要按照其驱动IC的时序进行。

在这里给出一个ST7565作为驱动IC的液晶显示驱动程序。
;***************************************************
;NOTE:THIS PROGRAM USE internal resistance !
;use all power setting(CONVERTER,REGULATOR,FOLLOWER)
;IN PCB,Ra,Rb is open
;***************************************************
C68        EQU        p3.7
E           EQU     P3.1
RW          EQU     p3.0
A0        EQU     P3.2
RES         EQU     P3.5
CS1        EQU        P3.4

;*****************************************
            ORG     0000H
    LJMP    INIT
INIT:   
    ;SETB    RES
    ;LCALL   TT1
    CLR     RES
    LCALL   TT1
    SETB    RES
    LCALL   TT1
    CLR    CS1
    SETB    C68       ; SET TO 6800 SERIES
    MOV     P1,#0A0H  ;;;SET ADC=0;adc=0---normal;adc=1---reverse;
    LCALL   WRCOM
    MOV     P1,#0A6H  ;;;SET REVERSE DISPLAY=normal(is 0)
    LCALL   WRCOM
    LCALL   T2
    MOV     P1,#0C8H  ;SET SHL=1(c8h-reverse direction;c0h-normal direction)
    LCALL   WRCOM
    LCALL   T2
    MOV     P1,#0A2H  ;SET BIAS=0(a2h-1/9bias;;a3h-1/7bias)
    LCALL   WRCOM
    LCALL   T2
    
    
    MOV     P1,#0F8H  ;set BOOSTER RATIO  
    LCALL   WRCOM
    LCALL   T2
    MOV     P1,#00H ;X234X(00h--x2,x3,x4;01h-x5;03h-x6)
    LCALL   WRCOM
    LCALL   T2
    
    MOV     P1,#22H  
       LCALL   WRCOM
    LCALL   T2
    MOV     P1,#81H  ;;SET REFERENCE VOLTAGE
    LCALL   WRCOM
    LCALL   T2
    MOV     P1,#15H  ;SET SV5-SV0=63;;;volume--00h-3fh
    LCALL   WRCOM
    LCALL   T2
    MOV     P1,#0AcH  ;SET STATIC INDICATOR MODE=ON
    LCALL   WRCOM
    LCALL   T2
    MOV     P1,#00H  ;SET blinking off;
    LCALL   WRCOM
    LCALL   T2
    
    MOV     P1,#2CH  ;SET POWER CONTROL VC=1
    LCALL   WRCOM
    LCALL   T2
    MOV     P1,#2EH  ;SET POWER CONTROL VC=1,VR=1,VF=0
    LCALL   WRCOM
    LCALL   T2
    MOV     P1,#2FH  ;SET POWER CONTROL VC=1,VR=1,VF=1
    LCALL   WRCOM
    LCALL   T2       ;;;;;T2>50MS

    ;MOV     P1,#40H  ;;SET INITIAL DISPLAY LINE IS 0
    ;LCALL   WRCOM
    ;LCALL   T2
    
    MOV     P1,#0AFH  ;DISPLAY ON
    LCALL   WRCOM
    
    

MAIN:    MOV     A,#0FFH  ;ENTIRE DIPLAY,EVERY DOT IS ON
    LCALL   WR128
    LCALL   T4

loop1:     
    JB    P3.3,$
    LCALL    T4
    JNB    P3.3,$    

        MOV     A,#55H
        LCALL   WR128
        LCALL   T4
loop2:     
     JB    P3.3,$
    LCALL    T4
    JNB    P3.3,$         

        MOV     A,#0AAH
        LCALL   WR128
loop3:    
    JB    P3.3,$
    LCALL    T4
    JNB    P3.3,$    

    MOV     R1,#0FFH
    MOV     R2,#00H
    LCALL   WR64
    LCALL   T4
loop4:
    JB    P3.3,$
    LCALL    T4
    JNB    P3.3,$    

    MOV     R1,#00H
    MOV     R2,#0FFH
    LCALL   WR64
    LCALL   T4
loop5:    
    JB    P3.3,$
    LCALL    T4
    JNB    P3.3,$    

        MOV     R1,#55H
    MOV     R2,#0AAH
    LCALL   WR64
    LCALL   T4
loop6:    
    JB    P3.3,$
    LCALL    T4
    JNB    P3.3,$    

       MOV     R1,#0AAH
    MOV     R2,#55H
    LCALL   WR64
loop7:    
    JB    P3.3,$
    LCALL    T4
    JNB    P3.3,$    
    
    MOV     DPTR,#TAB1
    LCALL   FULLSCREEN
    LCALL   T4
loop8:    
    JB    P3.3,$
    LCALL    T4
    JNB    P3.3,$    

    LJMP    MAIN
;***********************END OF PROGRAM**********************

;***********************************************************
WR128:
    MOV     R7,#04H
    MOV     R6,#0B0H
WDAT2:  MOV     P1,R6
    LCALL   WRCOM
    MOV     R5,#80H
    MOV     P1,#10H   ;;SET COLUMN ADDRESS IS 0000H
    LCALL   WRCOM
    MOV     P1,#00H
    LCALL   WRCOM
WDAT1:  MOV     P1,A
    LCALL   WRDAT
    DJNZ    R5,WDAT1
    INC     R6
    DJNZ    R7,WDAT2
    RET
;*********************************************
WR64:
    MOV     R7,#04H
    MOV     R6,#0B0H
WDAT22: MOV     P1,R6
    LCALL   WRCOM
    MOV     R5,#40H
    MOV     P1,#10H   ;;SET COLUMN ADDRESS IS 0000H
    LCALL   WRCOM
    MOV     P1,#00H
    LCALL   WRCOM
WDAT21: MOV     P1,R1
    LCALL   WRDAT
    LCALL   TT1
    MOV     P1,R2
    LCALL   WRDAT
    DJNZ    R5,WDAT21
    INC     R6
    DJNZ    R7,WDAT22
    RET
;**************WRITE ONE SCREEN**************************
FULLSCREEN:
    MOV     R7,#04H
    MOV     R6,#0B0H    ;set page address is 0000h
WDAT3:  MOV     P1,R6
    LCALL   WRCOM
    MOV     R5,#80H
    MOV     P1,#10H     ;;SET COLUMN ADDRESS IS 0000H
    LCALL   WRCOM
    MOV     P1,#00H
    LCALL   WRCOM
WDAT4:  CLR     A
    MOVC    A,@A+DPTR
    ;CPL     A             
    MOV     P1,A
    LCALL   WRDAT
    INC     DPTR
    DJNZ    R5,WDAT4
    INC     R6
    DJNZ    R7,WDAT3
    RET
;******************************************
WRCOM:  LCALL   TT1
    CLR     A0
    CLR     RW
    SETB    E
    NOP
    NOP
    NOP
    CLR     E
    RET
;*******************************************

WRDAT:  LCALL   TT1
    SETB    A0
    CLR     RW
    SETB    E
    NOP
    NOP
    NOP
    CLR     E
    RET
;*******************************************
TT1:
    MOV     R4,#80H
    DJNZ    R4,$
    RET
;*******************************************
T2:     MOV     R4,#01H;DELAY 0.26S
T22:    MOV     R3,#030H
T21:    MOV     R2,#0FFH
    DJNZ    R2,$
    DJNZ    R3,T21
    DJNZ    R4,T22
    RET
;******************************************
T3:     MOV     R4,#02H;DELAY 0.52S
T32:    MOV     R3,#0FFH
T31:    MOV     R2,#0FFH
    DJNZ    R2,$
    DJNZ    R3,T31
    DJNZ    R4,T32
    RET
;******************************************

T4:     MOV     R4,#01H;DELAY 1.56S
T42:    MOV     30H,#0FFH
T41:    MOV     R2,#0FFH
    DJNZ    R2,$
    DJNZ    30H,T41
    DJNZ    R4,T42
    RET
;**********************************************************
TAB1:
db 0ffh,001h,001h,001h,001h,001h,001h,001h,001h,001h
db 041h,0c9h,099h,011h,031h,0b1h,0d1h,0d1h,091h,051h
db 0d1h,0b1h,031h,001h,001h,001h,001h,001h,001h,001h
db 001h,001h,001h,001h,001h,001h,001h,001h,001h,001h
db 081h,081h,0f9h,0f9h,081h,0f9h,0f9h,001h,0f1h,0f1h
db 001h,0f9h,0f9h,001h,001h,001h,001h,001h,001h,001h
db 001h,001h,001h,001h,001h,001h,001h,001h,001h,001h
db 001h,001h,001h,0f9h,0f9h,0a9h,0a9h,0a9h,0a9h,0f9h
db 0f9h,001h,001h,001h,001h,001h,001h,001h,001h,001h
db 001h,001h,001h,001h,001h,001h,001h,001h,001h,001h
db 081h,0c1h,0e1h,0f9h,099h,081h,0f9h,0f9h,061h,021h
db 031h,091h,081h,001h,001h,001h,001h,001h,001h,001h
db 001h,001h,001h,001h,001h,001h,001h,0ffh

db 0ffh,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 008h,07ch,07eh,022h,022h,032h,01ah,07fh,07fh,01ah
db 032h,022h,022h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 010h,030h,03fh,05fh,068h,03fh,01fh,000h,01fh,01fh
db 000h,07fh,07fh,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,07eh,07eh,02ah,02ah,07eh,07eh,07eh,07eh,02ah
db 02ah,07eh,07eh,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 008h,008h,00bh,00bh,008h,07ch,07dh,00bh,00ah,00ah
db 00ah,00bh,00bh,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,0ffh

db 0ffh,000h,000h,000h,000h,000h,030h,078h,0c8h,088h
db 098h,018h,000h,008h,0f8h,0f8h,088h,088h,0f8h,0f8h
db 008h,008h,0f8h,0f8h,088h,0c8h,0d8h,018h,000h,008h
db 0f8h,0f8h,0f8h,0c8h,0f8h,0f8h,008h,000h,018h,018h
db 0c8h,0f8h,038h,008h,000h,008h,0f8h,0f8h,088h,088h
db 0f8h,0f8h,008h,008h,0f8h,0f8h,088h,0c8h,0d8h,018h
db 000h,008h,0f8h,0f8h,0f8h,0c8h,0f8h,0f8h,008h,000h
db 008h,008h,0f8h,0f8h,008h,008h,000h,000h,008h,008h
db 0f8h,0f8h,008h,008h,000h,008h,0f8h,0f8h,0f8h,0c8h
db 0f8h,0f8h,008h,0e0h,0f0h,018h,008h,018h,018h,000h
db 000h,008h,0f8h,0f8h,088h,088h,0f8h,0f8h,008h,008h
db 0f8h,0f8h,008h,008h,0f8h,0f8h,008h,000h,000h,0e0h
db 0f8h,0f8h,0e0h,000h,000h,000h,000h,0ffh

db 0ffh,080h,080h,080h,080h,080h,08ch,08ch,088h,088h
db 08fh,087h,080h,088h,08fh,08fh,088h,088h,08fh,08fh
db 088h,088h,08fh,08fh,088h,089h,08dh,08ch,080h,088h
db 08fh,08fh,089h,087h,08fh,08fh,080h,080h,088h,08eh
db 08fh,089h,08ch,08ch,080h,088h,08fh,08fh,088h,088h
db 08fh,08fh,088h,088h,08fh,08fh,088h,089h,08dh,08ch
db 080h,088h,08fh,08fh,089h,087h,08fh,08fh,080h,098h
db 098h,090h,09fh,08fh,080h,080h,080h,080h,088h,088h
db 08fh,08fh,088h,088h,080h,088h,08fh,08fh,089h,087h
db 08fh,08fh,080h,083h,087h,08ch,089h,08fh,087h,081h
db 080h,088h,08fh,08fh,088h,088h,08fh,08fh,088h,080h
db 087h,08fh,088h,088h,08fh,087h,080h,088h,08eh,08fh
db 089h,089h,08fh,08eh,088h,080h,080h,0ffh
END

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值