機(jī)電之家資源網(wǎng)
單片機(jī)首頁(yè)|單片機(jī)基礎(chǔ)|單片機(jī)應(yīng)用|單片機(jī)開(kāi)發(fā)|單片機(jī)文案|軟件資料下載|音響制作|電路圖下載 |嵌入式開(kāi)發(fā)
培訓(xùn)信息
贊助商
MAX7219測(cè)試程序(匯編)
MAX7219測(cè)試程序(匯編)
 更新時(shí)間:2008-8-18 13:23:19  點(diǎn)擊數(shù):27
【字體: 字體顏色

movwf DDATA
call Write7219
call Delay1ms
movlw 0x06
movwf DCOMMAND
movlw 0x05
movwf DDATA
call Write7219 ;bit5 is 5
call Delay1ms
;Begin Display
movlw 0x0c
movwf DCOMMAND
movlw 0x01
movwf DDATA
call Write7219 ;write in 0c01H, exit shut down state.
call Delay1s ;wait for 3 seconds.
;call Delay1s
;call Delay1s
;movlw 0x0c
;movwf DCOMMAND
;movlw 0x00
;movwf DDATA
;call Write7219 ;write in 0c00H, shut down MAX7219.
call Delay1s
return
AddressTable ;list of display data
addwf PCL
retlw 0x0 ;NO-OP
retlw 0x1 ;DIG 0
retlw 0x2 ;DIG 1
retlw 0x3 ;DIG 2
retlw 0x4 ;DIG 3
retlw 0x5 ;DIG 4
retlw 0x6 ;DIG 5
retlw 0x7 ;DIG 6
retlw 0x8 ;DIG 7
retlw 0x9 ;DECODE MODE
retlw 0xa ;INTENSITY
retlw 0xb ;SCAN LIMIT
retlw 0xC ;SHUIDOWN
Write7219
;this function use address 0x0c,0x0d,0x0e,0x0f.
;address 0x0c is data send to MAX7219
;address 0x0d is display command
;address 0x0e is display data
;address 0x0f is cont used
;write address 0x0c to MAX7219 each time
bcf 0x06,2 ;set LOAD is low and MAX7219 begin to recive data
movlw 0x08
movwf 0x0f
movf DCOMMAND,w ;send display address to MAX7219
movwf 0x0c
call SendData
movlw 0x08
movwf 0x0f
movf DDATA,w ;send display data to MAX7219
movwf 0x0c
call SendData
;set a puls from LOAD to MAX7219
bcf 0x06,2 ;LOAD = 0
bsf 0x06,2 ;LOAD = 1
nop ;wait 3 comand times.
nop
nop
bcf 0x06,2 ;LOAD = 0
nop
return
SendData
;this function is used to send data in address 0x0c to MAX7219 from the high
est place.
bcf 0x06,3 ;CLOCK = 0
bcf 0x06,1 ;DATA = 0
btfsc 0x0c,7 ;if bit7 of 0x0c is 0 then skip next command.
bsf 0x06,1 ;DATA = 1
nop
nop
nop ;wait 3 command times.
nop
nop
bsf 0x06,3 ;CLOCK = 1
nop
nop
nop ;delay 5 comand times and clean the Watchdog.
clrwdt
nop
nop
nop
nop
nop
bcf 0x06,3 ;CLOCK = 0
rlf 0x0c,1 ;0x0c move left a bit.
decfsz 0x0f,1 ;0x0f = 0x0f - 1, if x00f = 0 then return to Write7219.
goto SendData
return
Delay1ms
movlw 0x28 ;0x25 = 40D = 28H
movwf 0x0c
delay1ms_loop1
movlw 0x05
movwf 0x0f
delay1ms_loop2 ;40 * 25 = 1000 us = 1ms
clrwdt ;clean watchdog
decfsz 0x0f,1
goto delay1ms_loop2
decfsz 0x0c,1
goto delay1ms_loop1
return
Delay1s
movlw 0xce ;every time use 4.85ms, 1000/4.85=206.1D=CEH
movwf 0x1a
delay1s_loop1
movlw 0x05
movwf 0x1b
delay1s_loop2 ;4.85 ms * 206 = 1 s
clrwdt
call Delay1ms
decfsz 0x1b,1
goto delay1s_loop2
decfsz 0x1a,1
goto delay1s_loop1
return
end 
摘自ec66.com
  • 上一篇: 多功能串行LED顯示驅(qū)動(dòng)器MAX7219
  • 下一篇: 一個(gè)液晶顯示的數(shù)字式電腦溫度計(jì)
  • 發(fā)表評(píng)論   告訴好友   打印此文  收藏此頁(yè)  關(guān)閉窗口  返回頂部
    熱點(diǎn)文章
     
    推薦文章
     
    相關(guān)文章
    網(wǎng)友評(píng)論:(只顯示最新5條。)
    關(guān)于我們 | 聯(lián)系我們 | 廣告合作 | 付款方式 | 使用幫助 | 機(jī)電之家 | 會(huì)員助手 | 免費(fèi)鏈接

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

    主辦:杭州市高新區(qū)(濱江)機(jī)電一體化學(xué)會(huì)
    中國(guó)行業(yè)電子商務(wù)100強(qiáng)網(wǎng)站

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