機電之家資源網
單片機首頁|單片機基礎|單片機應用|單片機開發(fā)|單片機文案|軟件資料下載|音響制作|電路圖下載 |嵌入式開發(fā)
培訓信息
贊助商
12864 液晶顯示程序
12864 液晶顯示程序
 更新時間:2008-7-26 16:27:54  點擊數(shù):3
【字體: 字體顏色
家好!發(fā)兩個12864的點陣液晶顯示程序。一個是漢字顯示。一個是圖畫的!搞了很久。是匯編的!發(fā)上來看看有沒有需要的朋友可以參考一下!顯示漢字的時候請注意液晶的取模方式。一種是橫向的一種是縱向的。
 LIST P=16F877A
   #INCLUDE <P16F877A.INC>
   ERRORLEVEL 2

                        XCS      EQU  20H    ;顯示器片選0=CS1,1=CS2      ;20H-2FH為位
                        BZPD     EQU  21H           ;0=上8X8半字,1=下8X8半字
                        HHBZ     EQU  22H             ;換行標志
                        HZDH     EQU  23H
                        INDEX    EQU  24H
                        LCDFLAG  EQU  25H
                        R4       EQU  26H
                        R5       EQU  27H
                        R6       EQU  28H
                        R7       EQU  29H
                        R0       EQU  2AH           ;0=顯示漢字,1=顯示動畫
                        LCD_RW   EQU  1
                        LCD_DI   EQU   0
                        LCD_E  EQU 2
                        LCD_CS1 EQU 3
                        LCD_CS2 EQU  4
                        LCD_RST EQU  5
                        LCD_OPEN EQU 30H
                        LCD_LINE EQU 31H
                        LCD_PAGE EQU 32H
                        LCD_Y    EQU 33H
                        YCPD     EQU 34H           ;左右半屏溢出判斷
                        HHPD     EQU 35H           ;換行判斷
                        XWPD     EQU 36H
                        R1       EQU 37H
                        R2       EQU 38H
                        R3       EQU 39H
                      
                      
                        INDEX1   EQU 42H 
                        INDEX2   EQU 41H
                        INDEX3   EQU 43H
                        YCPD1    EQU 40H
                             ;寫完一整屏判斷
                        ORG 0000H
                        NOP
                        GOTO MAIN
                        ORG 005H


MAIN:                  
                        BANKSEL TRISC
                        MOVLW 00H
                        MOVWF TRISC
                        MOVWF TRISD
                        BANKSEL PORTC
                        BCF PORTC,LCD_RST
                        CALL DLY10
                        CALL DLY10 
                        BSF PORTC,LCD_RST
                        MOVLW 00H
                        MOVWF XCS
                        MOVLW 01H              ;選擇CS2
                        MOVWF LCD_OPEN         ;開顯示器1,關顯示器     
                        CALL LCDOPEN
                        CALL QINGPING
                    
                        MOVLW 01H
                        MOVWF XCS
                        MOVLW 01H              ;選擇CS2
                        MOVWF LCD_OPEN         ;開顯示器1,關顯示器     
                        CALL LCDOPEN
                        CALL QINGPING
            
                        CALL HANZI
LOOPM:                  GOTO LOOPM
;********************************************************************

QINGPING:
                        MOVLW 00H
                        MOVWF  LCD_LINE
                        CALL SETLINE          ;設置起始
                

                        MOVLW 00H
                        MOVWF  LCD_PAGE
                        CALL SETPAGE                ;設置頁地

                        MOVLW  00H
                        MOVWF  LCD_Y
                        CALL SETY                 ;設置列地
                    ;CS1

                        GOTO  CLRST3
CLR0:                   INCF LCD_PAGE,F
CLRST3:                 CALL SETPAGE
                        MOVLW 40H
                        MOVWF R7
SDF:                    MOVLW 00H
                        MOVWF LCDFLAG
                        CALL LCDWRDATA
                        DECFSZ R7,F
                        GOTO SDF
                        MOVLW 0BFH
                        XORWF LCD_PAGE,W
                        BTFSS STATUS,Z
                        GOTO CLR0
    
                        RETURN
;初始化完畢
;*************************************************************************
HANZI:
                        BANKSEL PORTC
                        MOVLW 00H
                        MOVWF XWPD
HZ0:                    CLRF XCS
                        MOVLW 00H
                        MOVWF  LCD_LINE
                        CALL SETLINE          ;設置起始
                   

                        MOVLW 00H
                        MOVWF  LCD_PAGE
                        CALL SETPAGE                ;設置頁地

                        MOVLW  00H
                        MOVWF  LCD_Y
                        CALL SETY  
                        MOVLW 00H
                        MOVWF INDEX3
                        MOVWF INDEX2
                      
                        MOVWF R1
JBO:                    MOVLW 00H
                        MOVWF  HHPD
HZ7:                    MOVLW 00H
                        MOVWF  YCPD
HZ8:                    CLRF BZPD
HZ3:                    MOVLW 08H
                        MOVWF R0          ;寫左上8個Y列
                       
HZ1:                   
                        MOVFW R1
                        CALL HZDOT
                        CLRF PCLATH
                        MOVWF LCDFLAG
                        CALL LCDWRDATA
                        INCF R1,F
           
LOOPAN:
                        INCF LCD_Y,F
                        DECFSZ  R0,F
                        GOTO HZ1
LOOPQW                      
                        MOVLW 00H
                        XORWF  BZPD,W
                        BTFSS STATUS,Z
                        GOTO HZ2
                        CLRF STATUS                        ;Y列減8, 即返回掃描
                        MOVLW 08H
                        SUBWF  LCD_Y,F
                        CALL SETY
                        INCF LCD_PAGE ,F               ;頁地址加1,即換第2頁掃描
                        CALL SETPAGE
                        MOVLW 01H
                        MOVWF BZPD
                        GOTO  HZ3
HZ2:                   
                        DECF LCD_PAGE,F                ;返回到第1頁中,準備下一個半
                        CALL SETPAGE
                        INCF YCPD,F
                        MOVLW 08H
                        XORWF YCPD,W
                        BTFSS STATUS,Z
                        GOTO  HZ8
                        MOVLW 01H
                        XORWF  XCS,W
                        BTFSC STATUS,Z
                        GOTO HZ9
                        MOVLW 01H
                        MOVWF XCS                     ;換屏
                        MOVLW 0XB8
                        CALL SETPAGE
                        MOVLW 00H
                        MOVWF  LCD_Y                      ;置列
                        CALL SETY
                        GOTO HZ7

HZ9:               
                        CLRF XCS                      ;寫完一行后從CS2返回到CS1
                        INCF LCD_PAGE,F
                        INCF LCD_PAGE,F
                        CALL SETPAGE                   ;下一行開始
                        MOVLW 00H
                        MOVWF LCD_Y
                        CALL SETY
                        INCF HHPD,F
                        MOVLW 03H
                        XORWF HHPD,Z
                        BTFSS STATUS,Z
                        GOTO HZ7
                        CLRF STATUS
                        INCF XWPD,F
                        MOVLW 01H
                        XORWF XWPD,W
                        BTFSS STATUS,Z
                        GOTO JBO
                        RETURN
         
                       
LCDWRINST:              NOP
                        BSF PORTC,LCD_RST
                        CLRF STATUS
                        MOVLW 01H
                        XORWF XCS,W
                        BTFSC STATUS,Z
                        GOTO INS0
                        BSF PORTC,LCD_CS1
                        BCF PORTC,LCD_CS2
                        GOTO  INS1
INS0:                   BCF  PORTC, LCD_CS1
                        BSF  PORTC, LCD_CS2
INS1:                   BSF  PORTC, LCD_E
                        BCF  PORTC, LCD_DI
                        BCF  PORTC, LCD_RW
                        MOVFW LCDFLAG
                        MOVWF PORTD
                        CALL DLY10  
                        BCF  PORTC, LCD_E
                        CALL DLY10
                        NOP
                        RETURN

LCDWRDATA:               NOP
                        BSF PORTC,LCD_RST
                        CLRF STATUS
                        MOVLW 01H
                        XORWF XCS,W
                        BTFSC STATUS,Z
                        GOTO DAT0
                        BSF  PORTC,LCD_CS1
                        BCF  PORTC,LCD_CS2
                        GOTO DAT1
DAT0:                   BCF  PORTC,LCD_CS1
                        BSF  PORTC,LCD_CS2
DAT1:                  
                        BSF  PORTC, LCD_E
                        BSF  PORTC, LCD_DI
                        BCF  PORTC, LCD_RW
                        MOVFW LCDFLAG
                        MOVWF PORTD
                        CALL DLY10
                        BCF  PORTC, LCD_E
                        CALL DLY10
                        NOP
                        RETURN

LCDOPEN:                MOVLW 03FH      ;開顯示器
                        ANDWF LCD_OPEN,F
                        MOVLW 3EH
                        IORWF LCD_OPEN,F
                        MOVFW LCD_OPEN
                        MOVWF LCDFLAG
                        CALL LCDWRINST
                        NOP
                        RETURN

SETLINE:                MOVLW 0C0H
                        IORWF LCD_LINE,F
                        MOVFW LCD_LINE
                        MOVWF LCDFLAG
                        CALL LCDWRINST
                        NOP
                        RETURN

SETPAGE:                MOVLW 0BFH
                        ANDWF LCD_PAGE,F
                        MOVLW 0B8H
                        IORWF LCD_PAGE,F
                        MOVFW LCD_PAGE
                        MOVWF LCDFLAG
                        CALL LCDWRINST
                        NOP
                        RETURN

SETY:                   MOVLW 7FH
                        ANDWF LCD_Y,F
                        MOVLW 40H
                        IORWF LCD_Y,F
                        MOVFW LCD_Y
                        MOVWF LCDFLAG
                        NOP                  ;設置列地址
                        CALL LCDWRINST
                        NOP
                        RETURN

DLY10:                   NOP
                        MOVLW 01H
                        MOVWF R5
DL1:                   
                        MOVLW 01H
                        MOVWF R4
                   
DL2:
                        MOVLW 0FH
                        MOVWF  R6
                   
DL3:
                        DECFSZ R6,F
                        GOTO DL3
                        DECFSZ R4,F
                        GOTO DL2
                        DECFSZ  R5,
                        GOTO DL1
                        NOP
                        RETURN
HZDOT:
 MOVLW LOW(TABLE)
 MOVWF INDEX
 MOVLW 03H
 XORWF R1,W
 BTFSS STATUS,Z
 GOTO YUIO
 MOVLW 00H
 MOVWF INDEX
 INCF INDEX2,F
 GOTO JKLO
YUIO:
 MOVFW R1
 ADDWF INDEX,F
JKLO:
 MOVLW HIGH(TABLE)
 MOVWF INDEX1
 MOVFW INDEX2
 ADDWF INDEX1,F
 MOVFW INDEX1
 MOVWF PCLATH
 MOVF INDEX,W
 MOVWF PCL
;新   CD0C2
TABLE:
DT  040H,044H,044H,044H,04cH,054H,065H,0c6H
DT  064H,054H,04cH,044H,046H,064H,040H,00H
DT  00H,042H,022H,012H,01aH,042H,082H,07fH
DT  02H,02H,0aH,012H,033H,062H,00H,00H       ;親

DT  040H,0b0H,092H,096H,09aH,092H,0f2H,09eH
DT  092H,091H,099H,095H,091H,050H,030H,00H
DT  00H,00H,040H,030H,08cH,083H,046H,02aH
DT  012H,02aH,026H,042H,0c0H,040H,00H,00H       ;愛

DT  00H,0f8H,0cH,0bH,08H,08H,0fcH,028H
DT  090H,0fH,08H,08H,08H,0fcH,08H,00H
DT  00H,07fH,021H,021H,021H,021H,07fH,00H
DT  00H,01H,043H,080H,040H,03fH,00H,00H       ;的

DT  010H,010H,0f0H,01fH,010H,0f0H,00H,0deH
DT  052H,052H,052H,052H,052H,0dfH,02H,00H
DT  040H,022H,015H,08H,014H,023H,00H,0ffH
DT  012H,012H,012H,052H,092H,07fH,00H,00H       ;娟

DT  020H,024H,024H,024H,0feH,023H,022H,020H
DT  0ffH,020H,022H,0acH,020H,030H,020H,00H
DT  00H,08H,048H,084H,07fH,02H,021H,010H
DT  09H,06H,01aH,061H,080H,0e0H,00H,00H       ;我

DT  040H,0b0H,092H,096H,09aH,092H,0f2H,09eH
DT  092H,091H,099H,095H,091H,050H,030H,00H
DT  00H,00H,040H,030H,08cH,083H,046H,02aH
DT  012H,02aH,026H,042H,0c0H,040H,00H,00H       ;愛

DT  040H,020H,0f8H,07H,040H,020H,018H,0fH
DT  08H,0c8H,08H,08H,028H,018H,00H,00H
DT  00H,00H,0ffH,00H,00H,08H,04H,043H
DT  080H,07fH,00H,01H,06H,0cH,00H,00H       ;你

DT  0fcH,04H,0feH,04H,0feH,042H,0b2H,0eH
DT  00H,0e2H,022H,0f2H,022H,0ffH,02H,00H
DT  0fH,04H,0fH,00H,0ffH,08H,011H,0eH
DT  00H,0fH,04H,04fH,080H,0ffH,00H,00H       ;啊

;杭   CBABC
DT 000H,010H,0D0H,0FFH,0FEH,090H,010H,008H
DT 000H,006H,001H,0FFH,07FH,001H,083H,040H
DT 0E8H,0C9H,04FH,04EH,0C8H,0E8H,04CH,008H
DT 07FH,03FH,000H,000H,07FH,0FFH,0C0H,070H

;州   CD6DD
DT 000H,010H,0E0H,0C0H,0FFH,0FEH,010H,0E0H
DT 000H,080H,041H,070H,03FH,00FH,000H,001H
DT 0C0H,0FEH,0FCH,030H,0E0H,0C0H,0FFH,0FEH
DT 000H,03FH,01FH,000H,001H,000H,0FFH,07FH

;求   CC7F3
DT 000H,000H,008H,068H,0C8H,088H,008H,0FFH
DT 000H,010H,070H,038H,00DH,026H,041H,0FFH
DT 0FEH,088H,0CBH,07EH,02CH,008H,000H,000H
DT 07FH,003H,006H,01CH,038H,070H,020H,000H

;是   CCAC7
DT 000H,080H,080H,080H,0FFH,0BEH,0AAH,0AAH
DT 000H,080H,060H,038H,00FH,01AH,030H,020H
DT 0AAH,0AAH,0AAH,0FEH,0BFH,082H,0C0H,080H
DT 07FH,07FH,044H,0C4H,0C6H,0C4H,0C0H,040H

;醫(yī)   CD2BD
DT 000H,000H,0FFH,0FEH,042H,0A2H,0BAH,09EH
DT 000H,040H,0FFH,07FH,060H,050H,058H,04CH
DT 096H,0F2H,0F2H,092H,09AH,0D3H,082H,000H
DT 046H,043H,041H,046H,04CH,058H,068H,040H

;學   CD1A7
DT 000H,010H,038H,01CH,00BH,04EH,048H,04BH
DT 000H,000H,004H,004H,004H,004H,044H,044H
DT 04EH,0C8H,0ECH,04FH,00AH,038H,01CH,008H
DT 0FFH,07FH,004H,004H,004H,006H,004H,000H

;科   CBFC6
DT 000H,024H,0A4H,0FEH,0FEH,0A3H,022H,0C0H
DT 000H,00CH,003H,0FFH,07FH,001H,00BH,008H
DT 08CH,038H,010H,0FFH,0FEH,000H,000H,000H
DT 00BH,005H,004H,0FFH,07FH,002H,003H,002H

;技   CBCBC
DT 000H,010H,010H,0FFH,0FEH,010H,098H,048H
DT 000H,00CH,046H,0FFH,07FH,001H,080H,040H
DT 0C8H,048H,07FH,07EH,0C8H,0E8H,04CH,008H
DT 061H,037H,01CH,01EH,037H,061H,0E0H,040H

;有   CD3D0
DT 000H,084H,044H,064H,034H,0FCH,0EFH,026H
DT 000H,000H,000H,000H,000H,0FFH,07FH,009H
DT 024H,024H,024H,0E4H,0F4H,024H,006H,004H
DT 009H,009H,049H,0FFH,07FH,000H,000H,000H

;限   CCFDE
DT 000H,0FFH,0FEH,042H,0BEH,01FH,002H,0FFH
DT 000H,0FFH,0FFH,008H,01FH,00FH,040H,0FFH
DT 0FEH,092H,092H,092H,0FEH,0FFH,002H,000H
DT 07FH,061H,036H,01CH,039H,06EH,0E4H,040H

;公   CB9AB
DT 000H,000H,080H,0C0H,070H,03EH,00FH,082H
DT 000H,001H,000H,060H,0F0H,078H,06EH,067H
DT 0C0H,080H,00FH,03EH,070H,0E0H,0C0H,080H
DT 021H,022H,026H,03CH,0F8H,070H,001H,000H

;司   CCBBE
DT 000H,000H,010H,0D2H,092H,092H,092H,092H
DT 000H,000H,000H,01FH,00FH,008H,008H,008H
DT 092H,0DAH,092H,002H,002H,0FEH,0FFH,002H
DT 01FH,00FH,000H,040H,040H,0FFH,07FH,000H

;地   CB5D8
DT 000H,020H,020H,0FEH,0FCH,020H,060H,0F8H
DT 000H,010H,030H,01FH,01FH,008H,004H,07FH
DT 0F0H,020H,0FFH,0FEH,010H,0F0H,0F8H,010H
DT 0FFH,0C0H,0C7H,0C7H,0C2H,0C7H,0F3H,040H

;址   CD6B7
DT 000H,020H,020H,0FEH,0FCH,020H,020H,0E0H
DT 000H,010H,030H,03FH,01FH,058H,048H,07FH
DT 0C0H,000H,000H,0FFH,0FEH,040H,060H,040H
DT 07FH,040H,040H,07FH,07FH,040H,060H,040H
;電   CB5E7
DT 000H,000H,0F8H,0F0H,090H,090H,090H,0FFH
DT 000H,000H,00FH,007H,004H,004H,004H,07FH
DT 0FEH,090H,090H,090H,0F0H,0F8H,010H,000H
DT 0FFH,0C4H,0C4H,0C4H,0CFH,0C7H,0F0H,040H

;話   CBBB0
DT 000H,040H,046H,0DCH,0E8H,040H,020H,024H
DT 000H,000H,020H,07FH,03FH,010H,008H,0FFH
DT 024H,024H,0FEH,0FEH,026H,023H,032H,020H
DT 07EH,042H,043H,043H,042H,0FEH,07FH,002H

    END

 LIST P=16F877A
   #INCLUDE <P16F877A.INC>
   ERRORLEVEL 2

                        XCS      EQU  20H    ;顯示器片選0=CS1,1=CS2      ;20H-2FH為位
                        BZPD     EQU  21H           ;0=上8X8半字,1=下8X8半字
                        HHBZ     EQU  22H             ;換行標志
                        HZDH     EQU  23H
                        INDEX    EQU  24H
                        LCDFLAG  EQU  25H
                        R4       EQU  26H
                        R5       EQU  27H
                        R6       EQU  28H
                        R7       EQU  29H
                        R0       EQU  2AH           ;0=顯示漢字,1=顯示動畫
                        LCD_RW   EQU  1
                        LCD_DI   EQU   0
                        LCD_E  EQU 2
                        LCD_CS1 EQU 3
                        LCD_CS2 EQU  4
                        LCD_RST EQU  5
                        LCD_OPEN EQU 30H
                        LCD_LINE EQU 31H
                        LCD_PAGE EQU 32H
                        LCD_Y    EQU 33H
                        YCPD     EQU 34H           ;左右半屏溢出判斷
                        HHPD     EQU 35H           ;換行判斷
                        XWPD     EQU 36H
                        R1       EQU 37H
                        R2       EQU 38H
                        R3       EQU 39H
                      
                      
                        INDEX1   EQU 42H 
                        INDEX2   EQU 41H
                        INDEX3   EQU 43H
                        YCPD1    EQU 40H
                             ;寫完一整屏判斷
                        ORG 0000H
                        NOP
                        GOTO MAIN
                        ORG 005H
MAIN
                        BANKSEL TRISC
                        MOVLW 00H
                        MOVWF TRISC
                        MOVWF TRISD
                        BANKSEL PORTC
                        BCF PORTC,LCD_RST
                        CALL DLY10
                        CALL DLY10
                        BSF PORTC,LCD_RST
                        MOVLW 00H
                        MOVWF XCS
                        MOVLW 01H              ;選擇CS2
                        MOVWF LCD_OPEN         ;開顯示器1,關顯示器     
                        CALL LCDOPEN
                        CALL QINGPING
                        CALL DLY10
                        MOVLW 01H
                        MOVWF XCS
                        MOVLW 01H              ;選擇CS2
                        MOVWF LCD_OPEN         ;開顯示器1,關顯示器     
                        CALL LCDOPEN
                        CALL QINGPING
                        CALL DLY10
                        NOP
                        CALL HANZI
LOOPM:                  GOTO LOOPM
;********************************************************************
QINGPING:
                        MOVLW 00H
                        MOVWF  LCD_LINE
                        CALL SETLINE          ;設置起始
                

                        MOVLW 00H
                        MOVWF  LCD_PAGE
                        CALL SETPAGE                ;設置頁地

                        MOVLW  00H
                        MOVWF  LCD_Y
                        CALL SETY                 ;設置列地
                    ;CS1

                        GOTO  CLRST3
CLR0:                   INCF LCD_PAGE,F
CLRST3:                 CALL SETPAGE
                        MOVLW 40H
                        MOVWF R7
SDF:                    MOVLW 00H
                        MOVWF LCDFLAG
                        CALL LCDWRDATA
                        DECFSZ R7,F
                        GOTO SDF
                        MOVLW 0BFH
                        XORWF LCD_PAGE,W
                        BTFSS STATUS,Z
                        GOTO CLR0
    
                        RETURN
;初始化完畢
;*************************************************************************
HANZI:
                        MOVLW 00H
                        MOVWF XWPD
HZ0:                    CLRF XCS
                       
                        MOVLW 00H
                        MOVWF R1
                        MOVLW 00H
                        MOVWF INDEX2
                   
                        MOVLW 00H
DH0:
                        MOVWF  XWPD
DH1:                   
                        CLRF XCS
                        MOVLW 00H
                        MOVWF  LCD_LINE
                        CALL SETLINE          ;設置起始
                

                        MOVLW 00H
                        MOVWF  LCD_PAGE
                        CALL SETPAGE                ;設置頁地

                        MOVLW  00H
                        MOVWF  LCD_Y
                        CALL SETY  

                        MOVLW 00H
                        MOVWF HHPD
                        MOVWF R1
DH2:
                        MOVLW  40H
                        MOVWF R0              ;寫上64個Y列
DH3:                   
                        MOVFW R1
                        CALL HZDOT
                        CLRF PCLATH
                        MOVWF LCDFLAG
                        CALL LCDWRDATA
                        INCF R1,F
LOOPAN:
                        INCF LCD_Y,F
                        DECFSZ  R0,F
                        GOTO DH3
                        MOVLW 01H
                        XORWF XCS,W
                        BTFSC STATUS,Z
                        GOTO DH4
                        MOVLW 01H
                        MOVWF XCS
                        MOVLW 0B8H
                        CALL SETPAGE
                        MOVLW 00H
                        MOVWF  LCD_Y
                        CALL SETY
                        GOTO DH2

DH4:                 
                        CLRF STATUS
                        CLRF XCS                        ;寫完一行后從CS2返回到CS1
                        INCF LCD_PAGE
                        CALL SETPAGE                   ;下一行開始
                        MOVLW 00H
                        MOVWF  LCD_Y
                        CALL SETY
                        INCF HHPD
                        MOVLW 08H
                        XORWF HHPD,W
                        BTFSS STATUS,Z
                        GOTO DH2
                        CLRF STATUS
                        INCF XWPD,F                      ;換第二幅畫面
                        MOVLW 01H
                        XORWF  XWPD,W
                        BTFSS STATUS,Z
                        GOTO DH1
                        NOP
                        RETURN
                       
LCDWRINST:              NOP
                        BSF PORTC,LCD_RST
                        CLRF STATUS
                        MOVLW 01H
                        XORWF XCS,W
                        BTFSC STATUS,Z
                        GOTO INS0
                        BSF PORTC,LCD_CS1
                        BCF PORTC,LCD_CS2
                        GOTO  INS1
INS0:                   BCF  PORTC, LCD_CS1
                        BSF  PORTC, LCD_CS2
INS1:                   BSF  PORTC, LCD_E
                        BCF  PORTC, LCD_DI
                        BCF  PORTC, LCD_RW
                        MOVFW LCDFLAG
                        MOVWF PORTD
                        CALL DLY10  
                        BCF  PORTC, LCD_E
                        CALL DLY10
                        NOP
                        RETURN

LCDWRDATA:               NOP
                        BSF PORTC,LCD_RST
                        CLRF STATUS
                        MOVLW 01H
                        XORWF XCS,W
                        BTFSC STATUS,Z
                        GOTO DAT0
                        BSF  PORTC,LCD_CS1
                        BCF  PORTC,LCD_CS2
                        GOTO DAT1
DAT0:                   BCF  PORTC,LCD_CS1
                        BSF  PORTC,LCD_CS2
DAT1:                  
                        BSF  PORTC, LCD_E
                        BSF  PORTC, LCD_DI
                        BCF  PORTC, LCD_RW
                        MOVFW LCDFLAG
                        MOVWF PORTD
                        CALL DLY10
                        BCF  PORTC, LCD_E
                        CALL DLY10
                        NOP
                        RETURN

LCDOPEN:                MOVLW 03FH      ;開顯示器
                        ANDWF LCD_OPEN,F
                        MOVLW 3EH
                        IORWF LCD_OPEN,F
                        MOVFW LCD_OPEN
                        MOVWF LCDFLAG
                        CALL LCDWRINST
                        NOP
                        RETURN

SETLINE:                MOVLW 0C0H
                        IORWF LCD_LINE,F
                        MOVFW LCD_LINE
                        MOVWF LCDFLAG
                        CALL LCDWRINST
                        NOP
                        RETURN

SETPAGE:                MOVLW 0BFH
                        ANDWF LCD_PAGE,F
                        MOVLW 0B8H
                        IORWF LCD_PAGE,F
                        MOVFW LCD_PAGE
                        MOVWF LCDFLAG
                        CALL LCDWRINST
                        NOP
                        RETURN

SETY:                   MOVLW 7FH
                        ANDWF LCD_Y,F
                        MOVLW 40H
                        IORWF LCD_Y,F
                        MOVFW LCD_Y
                        MOVWF LCDFLAG
                        NOP                  ;設置列地址
                        CALL LCDWRINST
                        NOP
                        RETURN
 
DLY10:                   NOP
                        MOVLW 01H
                        MOVWF R5
DL1:                   
                        MOVLW 01H
                        MOVWF R4
                   
DL2:
                        MOVLW 0FH
                        MOVWF  R6
                   
DL3:
                        DECFSZ R6,F
                        GOTO DL3
                        DECFSZ R4,F
                        GOTO DL2
                        DECFSZ  R5,
                        GOTO DL1
                        NOP
                        RETURN

HZDOT:
 MOVLW LOW(TABLE)
 MOVWF INDEX
 MOVLW 14H
 XORWF R1,W
 BTFSS STATUS,Z
 GOTO YUIO
 MOVLW 00H
 MOVWF INDEX
 INCF INDEX2,F
 GOTO JKLO
YUIO:
 MOVFW R1
 ADDWF INDEX,F
JKLO:
 MOVLW HIGH(TABLE)
 MOVWF INDEX1
 MOVFW INDEX2
 ADDWF INDEX1,F
 MOVFW INDEX1
 MOVWF PCLATH
 MOVF INDEX,W
 MOVWF PCL
TABLE:
;-------------------------------------------------------------------------------
DT 000H,000H,000H,000H,000H,000H,000H,000H,007H,0E7H,0E3H,0E1H,0E1H,0E1H,0E1H,0C1H
DT 0C1H,081H,081H,081H,083H,083H,083H,083H,087H,087H,08FH,08FH,09FH,0BFH,0FFH,0FFH
DT 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DT 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0F3H,0F3H,0F1H,0E1H,061H,061H,020H
DT 030H,030H,0B0H,0B0H,0B0H,0B8H,0B8H,0BCH,0BCH,03EH,03EH,03FH,03FH,07FH,07FH,07FH
DT 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DT 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FEH,0FEH,0FCH,0FCH,0FCH,0FEH,0FFH
DT 0F7H,0E3H,0E7H,0EFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,000H,000H,000H
DT 000H,000H,000H,000H,000H,000H,000H,000H,000H,001H,07FH,0FFH,0F3H,083H,083H,081H
DT 001H,001H,000H,080H,080H,000H,002H,002H,002H,006H,004H,0A5H,0EDH,0EDH,0EBH,0DBH
DT 0F7H,0BFH,07FH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0F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FH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DT 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,01FH,000H,000H,07CH,0FFH,0FFH,078H
DT 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DT 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,003H,0FFH
DT 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DT 0FFH,0FFH,0FFH,0FFH,0FFH,0E3H,0E3H,0C3H,087H,08FH,01FH,01FH,0BFH,0BFH,0FFH,0FFH
DT 0FFH,0F7H,0F3H,0F3H,0FBH,0FBH,0FBH,0FBH,0FBH,0FBH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DT 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,07FH,07FH,07FH,07FH,0FFH,0FFH,0FFH,0FFH
DT 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DT 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,00FH,000H,000H,000H,000H,000H,000H,000H
DT 000H,000H,000H,000H,000H,000H,0E0H,0F8H,0FCH,0FEH,0FEH,0FEH,0FEH,0FEH,0FCH,0FCH
DT 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,0F8H,0FFH
DT 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DT 0FFH,0FDH,0F9H,0F3H,0E7H,0C7H,087H,007H,007H,0C7H,087H,087H,08FH,08FH,08FH,0CFH
DT 0CFH,0DFH,0FFH,09FH,0DFH,0DFH,0FFH,0CFH,0EFH,0EFH,0FFH,0FFH,0CFH,0CFH,0E7H,0E7H
DT 0E3H,0E3H,0E3H,0F1H,0F9H,0F9H,0F8H,0FCH,0FCH,0FEH,0FEH,0FFH,0FFH,0FFH,0FFH,0FFH
DT 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DT 0FFH,0FFH,0FFH,0FFH,03FH,00FH,007H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DT 000H,000H,000H,000H,000H,000H,000H,007H,027H,07FH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DT 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,0E0H,0FCH,0FFH,0FFH
DT 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DT 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0F8H,0F1H,0F3H,0E7H,0CFH,0CFH,0DFH,0DFH
DT 09FH,09FH,0BFH,0BFH,0BFH,09FH,0DFH,0DFH,0DFH,0CFH,0EFH,0FFH,0FFH,0FFH,0FBH,0FFH
DT 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DT 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DT 0FFH,0F7H,0FDH,0FCH,0FCH,0FEH,0FFH,0FCH,0C0H,000H,000H,000H,000H,000H,000H,000H
DT 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,001H,0F1H,0FFH,0FFH
 END

  • 上一篇: pic單片機軟件解碼
  • 下一篇: 用普通IO口測量溫度(NTC)的程序
  • 發(fā)表評論   告訴好友   打印此文  收藏此頁  關閉窗口  返回頂部
    熱點文章
     
    推薦文章
     
    相關文章
    網友評論:(只顯示最新5條。)
    關于我們 | 聯(lián)系我們 | 廣告合作 | 付款方式 | 使用幫助 | 機電之家 | 會員助手 | 免費鏈接

    點擊這里給我發(fā)消息66821730(技術支持)點擊這里給我發(fā)消息66821730(廣告投放) 點擊這里給我發(fā)消息41031197(編輯) 點擊這里給我發(fā)消息58733127(審核)
    本站提供的機電設備,機電供求等信息由機電企業(yè)自行提供,該企業(yè)負責信息內容的真實性、準確性和合法性。
    機電之家對此不承擔任何保證責任,有侵犯您利益的地方請聯(lián)系機電之家,機電之家將及時作出處理。
    Copyright 2007 機電之家 Inc All Rights Reserved.機電之家-由機電一體化網更名-聲明
    電話:0571-87774297 傳真:0571-87774298
    杭州濱興科技有限公司提供技術支持

    主辦:杭州市高新區(qū)(濱江)機電一體化學會
    中國行業(yè)電子商務100強網站

    網站經營許可證:浙B2-20080178-1