新闻  |   论坛  |   博客  |   在线研讨会
一种通用的LCD显示屏驱动程序源程序
yanqin | 2009-04-17 10:22:24    阅读:2432   发布文章

一种通用的LCD显示屏驱动程序源程序


源代码(a)
;************同步串行输出到LCD的笔画电极*******
DATA_STORE
        BCF                SSPCON,SSPEN
        MOVLW        B‘00110000‘
        MOVWF        SSPCON
        MOVF        DATA1,0
        MOVWF        SSPBUF
LOOP11
        BANKSEL        TRISC
        BTFSS        SSPSTAT,BF
        GOTO        LOOP11
        BANKSEL        PORTC
        RETURN

源代码(b)

;*******显示矩阵校正程序*********
SHOW_ABLE
        CLRF        R0H
        CLRF        R0L
        CLRF        R1H
        CLRF        R1L
        CLRF        R2H
        CLRF        R2L
        CLRF        RR0H
        CLRF        RR0L
        CLRF        RR1H
        CLRF        RR1L
        CLRF        RR2H
        CLRF        RR2L
        BTFSC        STATUS_ALL,0
        GOTO        WRITE_OVER
        ;写入第一个数字显示值
        BTFSC        SHOW_NUM0,1
        BSF                R0L,2
        BTFSC        SHOW_NUM0,2
        BSF                R0L,3
        BTFSC        SHOW_NUM0,3
        BSF                R0H,0
        BTFSC        SHOW_NUM0,4
        BSF                R0H,1
        BTFSC        SHOW_NUM0,5
        BSF                R0H,3
        BTFSC        SHOW_NUM0,6
        BSF                R0L,0
        BTFSC        SHOW_NUM0,7
        BSF                R0L,6
…… ……
WRITE_OVER
        COMF        R0H,0
        MOVWF        RR0H
        COMF        R0L,0
        MOVWF        RR0L
        COMF        R1H,0
        MOVWF        RR1H
        COMF        R1L,0
        MOVWF        RR1L
        COMF        R2H,0
        MOVWF        RR2H
        COMF        R2L,0
        MOVWF        RR2L
        RETURN

源代码(c)

;********* LCD显示输出程序*****
LCD_SHOW
        MOVF        DISBIT_STATUS,W
        ADDWF        PCL,1
        GOTO        D_COM0
        GOTO        D_COM1
        GOTO        D_COM2
        GOTO        DL_COM0
        GOTO        DL_COM1
        GOTO        DL_COM2
D_COM0
        INCF        DISBIT_STATUS,1
        BCF                PORTC,0
        BSF                PORTC,1
        BSF                PORTC,2
        BSF                PORTC,4
        MOVF        LED,0
        MOVWF        DATA0
        CALL        DATA_STORE
        MOVF        R0L,0
        MOVWF        DATA0
        CALL        DATA_STORE
        MOVF        R0H,0
        MOVWF        DATA0        
        CALL        DATA_STORE
        ;设置COM0为低电平,其它1.5
        BCF                PORTC,1        
    GOTO        SHOW_OVER
D_COM1
…… ……
        ;设置COM1为低电平,其它1.5
        BCF                PORTC,2
        GOTO        SHOW_OVER
D_COM2
…… ……
;设置COM2为低电平,其它1.5
        BCF                PORTC,4                
        GOTO        SHOW_OVER
DL_COM0
…… ……
        ;设置COM0为高电平,其它1.5
        BSF                PORTC,1        
        GOTO        SHOW_OVER
DL_COM1
…… ……
        ;设置COM1为高电平,其它1.5
        BSF                PORTC,2        
        GOTO        SHOW_OVER        
DL_COM2
…… ……
        ;设置COM2为高电平,其它1.5
        BSF        PORTC,4        
SHOW_OVER
        RETURN








*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。

参与讨论
登录后参与讨论
推荐文章
最近访客