机电之家资源网
单片机首页|单片机基础|单片机应用|单片机开发|单片机文案|软件资料下载|音响制作|电路图下载 |嵌入式开发
培训信息
赞助商
MAX7219测试程序(汇编)
MAX7219测试程序(汇编)
 更新时间:2008-8-18 13:23:19  点击数: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显示驱动器MAX7219
  • 下一篇: 一个液晶显示的数字式电脑温度计
  • 发表评论   告诉好友   打印此文  收藏此页  关闭窗口  返回顶部
    热点文章
     
    推荐文章
     
    相关文章
    网友评论:(只显示最新5条。)
    关于我们 | 联系我们 | 广告合作 | 付款方式 | 使用帮助 | 机电之家 | 会员助手 | 免费链接

    点击这里给我发消息66821730(技术支持)点击这里给我发消息66821730(广告投放) 点击这里给我发消息41031197(编辑) 点击这里给我发消息58733127(审核)
    本站提供的机电设备,机电供求等信息由机电企业自行提供,该企业负责信息内容的真实性、准确性和合法性。
    机电之家对此不承担任何保证责任,有侵犯您利益的地方请联系机电之家,机电之家将及时作出处理。
    Copyright 2007 机电之家 Inc All Rights Reserved.机电之家-由机电一体化网更名-声明
    电话:0571-87774297 传真:0571-87774298
    杭州滨兴科技有限公司提供技术支持

    主办:杭州市高新区(滨江)机电一体化学会
    中国行业电子商务100强网站

    网站经营许可证:浙B2-20080178-1