迷狐直播免费版app下载-迷狐直播永久免费版下载-迷狐直播最新下载安装

機電之家資源網(wǎng)
單片機首頁|單片機基礎(chǔ)|單片機應用|單片機開發(fā)|單片機文案|軟件資料下載|音響制作|電路圖下載 |嵌入式開發(fā)
培訓信息
贊助商
在EM78Pxx上模擬8(COM)*8(SEG)LCD驅(qū)動
在EM78Pxx上模擬8(COM)*8(SEG)LCD驅(qū)動
 更新時間:2008-7-26 20:12:03  點擊數(shù):2
【字體: 字體顏色

;/*=============================================================================
;             在EM78Pxx上模擬8(COM)*8(SEG)LCD驅(qū)動                              |
;                                                                              |
;                                                                              |
;一. LCD掃描原理:                                                              |
;正向掃描: COM on=VCC,COM off=1/2VCC,對應SEG=1則輸出VSS,為0 則輸出VCC.         |
;反向掃描: COM on=VSS,COM off=1/2VCC,對應SEG=1則輸出VCC,為0 則輸出VSS.         |
;                                                                              |
;二. 電路接法:                                                                 |
;    所有COM口線都接一個上拉電阻和一個下拉電阻,阻值相同.                       |
;    當口線設(shè)為輸入時,端口電壓為1/2VCC.                                        |
;    COM I/O口設(shè)定高阻輸入&正常輸出.                                           |
;                                                                              |
;三. 使用方法:                                                                 |
;    由程序定時調(diào)用.                                                           |
;                                                                              |
;DATE:2005-02-24 ok                                                            |
;=============================================================================*/

#define LCD_scan_bearing  LCD_scan_status.0     ;//掃描方向
#define common_amount 4     ;//common pin  定義COM口的數(shù)量  max=8

;//LCD顯示代碼寄存器
COM_port == 5    ;//PORT5=COM0--COM7
SEG_port == 6    ;//PORT6=SEG0--SEG7

seg0 == 0x10                 ;//靜態(tài)變量
seg1 == 0x11
seg2 == 0x12
seg3 == 0x13
seg4 == 0x14
seg5 == 0x15
seg6 == 0x16
seg7 == 0x17
LCD_scan_status  == 0x18
LCD_scan_counter == 0x19


LCD_scan_temp    == 0x1a     ;//動態(tài)變量
seg_TEMP         == 0x1b
com_temp         == 0x1c

 


            !seg_port=0        ;//seg_port為outport

LCD_drive()
            SEG_temp=0xff
            com_temp=0xff
            LCD_scan_temp=LCD_scan_counter
            _if LCD_scan_temp!=0
            goto ld1
            jbc seg0,0           ;//COM0
            bc  SEG_temp,0
            jbc seg1,0
            bc  SEG_temp,1
            jbc seg2,0
            bc  SEG_temp,2
            jbc seg3,0
            bc  SEG_temp,3
            jbc seg4,0
            bc  SEG_temp,4
            jbc seg5,0
            bc  SEG_temp,5
            jbc seg6,0
            bc  SEG_temp,6
            jbc seg7,0
            bc  SEG_temp,7
            bc  com_temp,0
ld1:
            _if --LCD_scan_temp!=0
            goto ld2
            jbc seg0,1            ;//COM1
            bc  SEG_temp,0
            jbc seg1,1
            bc  SEG_temp,1
            jbc seg2,1
            bc  SEG_temp,2
            jbc seg3,1
            bc  SEG_temp,3
            jbc seg4,1
            bc  SEG_temp,4
            jbc seg5,1
            bc  SEG_temp,5
            jbc seg6,1
            bc  SEG_temp,6
            jbc seg7,1
            bc  SEG_temp,7
            bc  com_temp,1
ld2:
            _if --LCD_scan_temp!=0
            goto ld3
            jbc seg0,2               ;//COM2
            bc  SEG_temp,0
            jbc seg1,2
            bc  SEG_temp,1
            jbc seg2,2
            bc  SEG_temp,2
            jbc seg3,2
            bc  SEG_temp,3
            jbc seg4,2
            bc  SEG_temp,4
            jbc seg5,2
            bc  SEG_temp,5
            jbc seg6,2
            bc  SEG_temp,6
            jbc seg7,2
            bc  SEG_temp,7
            bc  com_temp,2
ld3:
            _if --LCD_scan_temp!=0
            goto ld4
            jbc seg0,3                  ;//COM3
            bc  SEG_temp,0
            jbc seg1,3
            bc  SEG_temp,1
            jbc seg2,3
            bc  SEG_temp,2
            jbc seg3,3
            bc  SEG_temp,3
            jbc seg4,3
            bc  SEG_temp,4
            jbc seg5,3
            bc  SEG_temp,5
            jbc seg6,3
            bc  SEG_temp,6
            jbc seg7,3
            bc  SEG_temp,7
            bc  com_temp,3
ld4:
            _if --LCD_scan_temp!=0
            goto ld5
            jbc seg0,4                  ;//COM4
            bc  SEG_temp,0
            jbc seg1,4
            bc  SEG_temp,1
            jbc seg2,4
            bc  SEG_temp,2
            jbc seg3,4
            bc  SEG_temp,3
            jbc seg4,4
            bc  SEG_temp,4
            jbc seg5,4
            bc  SEG_temp,5
            jbc seg6,4
            bc  SEG_temp,6
            jbc seg7,4
            bc  SEG_temp,7
            bc  com_temp,4
ld5:
            _if --LCD_scan_temp!=0
            goto ld6
            jbc seg0,5                     ;//COM5
            bc  SEG_temp,0
            jbc seg1,5
            bc  SEG_temp,1
            jbc seg2,5
            bc  SEG_temp,2
            jbc seg3,5
            bc  SEG_temp,3
            jbc seg4,5
            bc  SEG_temp,4
            jbc seg5,5
            bc  SEG_temp,5
            jbc seg6,5
            bc  SEG_temp,6
            jbc seg7,5
            bc  SEG_temp,7
            bc  com_temp,5
ld6:
            _if --LCD_scan_temp!=0
            goto ld7
            jbc seg0,6                          ;//COM6
            bc  SEG_temp,0
            jbc seg1,6
            bc  SEG_temp,1
            jbc seg2,6
            bc  SEG_temp,2
            jbc seg3,6
            bc  SEG_temp,3
            jbc seg4,6
            bc  SEG_temp,4
            jbc seg5,6
            bc  SEG_temp,5
            jbc seg6,6
            bc  SEG_temp,6
            jbc seg7,6
            bc  SEG_temp,7
            bc  com_temp,6
ld7:
            _if --LCD_scan_temp!=0
            goto ld8
            jbc seg0,7                          ;//COM7
            bc  SEG_temp,0
            jbc seg1,7
            bc  SEG_temp,1
            jbc seg2,7
            bc  SEG_temp,2
            jbc seg3,7
            bc  SEG_temp,3
            jbc seg4,7
            bc  SEG_temp,4
            jbc seg5,7
            bc  SEG_temp,5
            jbc seg6,7
            bc  SEG_temp,6
            jbc seg7,7
            bc  SEG_temp,7
            bc  com_temp,7
ld8:
            !com_port=com_temp
            if LCD_scan_bearing==0
               com  SEG_temp           ;//反向掃描COM=0 SEG=1
            else
               com  com_temp           ;//正向掃描COM=1 SEG=0
            endif
            seg_port=SEG_temp          ;//write seg
            com_port=com_temp          ;//write com

            if ++LCD_scan_counter>=common_amount   ;//檢查同一方向掃描是否完成
               LCD_scan_counter=0
               if LCD_scan_bearing==0       ;//已經(jīng)完成則改變掃描方向
                  LCD_scan_bearing=1
               else
                  LCD_scan_bearing=0
               endif
            endif
            return

  • 上一篇: EM78系列OTP型新一代8位單片機特點
  • 下一篇: EM78系列單片機程序設(shè)計
  • 發(fā)表評論   告訴好友   打印此文  收藏此頁  關(guān)閉窗口  返回頂部
    熱點文章
     
    推薦文章
     
    相關(guān)文章
    網(wǎng)友評論:(只顯示最新5條。)
    關(guān)于我們 | 聯(lián)系我們 | 廣告合作 | 付款方式 | 使用幫助 | 機電之家 | 會員助手 | 免費鏈接

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

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

    網(wǎng)站經(jīng)營許可證:浙B2-20080178-1