51/AVR单片机技术驿站!  <在线翻译>     便利工具    特色网址   无弹窗、无插件的绿色站点...  英才招聘   学历查询  喜欢>>收藏我站 

当前位置:首页 > 单片机源码 > 详细内容
绿岛小夜曲程序
作者:小泉  发布时间:2009/10/16  阅读次数:622  字体大小: 【】 【】【
;绿岛小夜曲
;硬件:喇叭,放大器,从p0.1输出
                 org         00h
               jmp         start
               org         0bh
               jmp         tim0
start:   mov         tmod,#01h
               mov         ie,#82h
start0: mov         30h,#00
next:     mov         a,30h
               mov         dptr,#table
               movc       a,@a+dptr
               mov         r2,a
               jz           end0
               anl         a,#0fh
               mov         r5,a
               mov         a,r2
               swap       a
               anl         a,#0fh
               jnz         sing
               clr         tr0
               jmp         d1
sing:     dec         a
               mov         22h,a
               rl           a
               mov         dptr,#table1
               movc       a,@a+dptr
               mov         th0,a
               mov         21h,a
               mov         a,22h
               rl           a
               inc         a
               movc       a,@a+dptr
               mov         tl0,a
               mov         20h,a
               setb       tr0
d1:         call       delay
               inc         30h
               jmp         next
end0:     clr         tr0
               jmp         start0
tim0:     push       acc
               push       psw
               mov         tl0,20h
               mov         th0,21h
               cpl         p0.1
               pop         psw
               pop         acc
               reti
delay:   mov         r7,#02
d2:         mov         r4,#187
d3:         mov         r3,#248
               djnz       r3,$
               djnz       r4,d3
               djnz       r7,d2
               djnz       r5,delay
               ret
table1: dw           64021,64103,64260,64400
               dw           64524,64580,64684,64777
               dw           64820,64898,64968,65030
               dw           65058,65110,65157
table:   ;1
               db           0a2h,0b2h,0d2h,0b2h,0a4h,0b2h,0d2h
               db           0b2h,0a2h,82h,72h,88h
               db           72h,82h,0a2h,82h,72h,62h,42h,62h
               db           38h,38h
               ;2
               db           0a4h,02h,0b2h,0a4h,84h
               db           72h,82h,72h,62h,72h,84h,72h
               db           64h,62h,12h,34h,02h,42h
               db           38h,38h
               ;3
               db           44h,02h,32h,44h,64h
               db           72h,82h,72h,62h,72h,84h,0a2h
               db           72h,74h,82h,0a4h,02h,0b2h
               db           0a8h,0a8h
               ;4
               db           0b2h,0b4h,0a2h,84h,82h,72h
               db           62h,72h,82h,0a2h,88h
               db           72h,74h,62h,42h,32h,32h,62h
               db           78h,78h
               ;5
               db           82h,84h,72h,82h,0a2h,84h
               db           72h,82h,72h,62h,48h
               db           32h,0a2h,82h,0f2h,0a2h,0b2h,82h,72h
               db           68h,68h
               ;6
               db           0b2h,0b2h,0b2h,0a2h,82h,84h,02h
               db           72h,74h,62h,42h,32h,42h,62h
               db           78h,78h
               db           0a2h,0b2h,0a2h,72h,82h,84h,82h
               ;7
               db           72h,74h,62h,44h,64h
               db           0a8h,0a4h,02h,0a2h
               db           0a2h,0b1h,0a1h,82h,0a2h,0b4h,0b2h,0c2h
               db           0a2h,0b2h,0a2h,0b2h,78h
               ;8
               db           84h,72h,62h,44h,02h,62h
               db           72h,81h,71h,62h,72h,84h,02h,0a2h
               db           0b4h,02h,82h,74h,82h,72h
               db           68h,68h
               db           00
               end
  

我要评论
  • 匿名发表
  • [添加到收藏夹]
  • 发表评论:(匿名发表无需登录,已登录用户可直接发表。) 登录状态:未登录
最新评论
所有评论[0]
    暂无已审核评论!

网站导航 管理登陆 ┊ 免责声明 问题反馈  友链说明
本站部分内容来自网络共享资源,如有冒犯您的权利请来信告之删除或纠正!
不得对本站进行复制、盗链或镜像,转载内容须获得同意或授权;欢迎友情链接、站务合作!

    我要报警 Alexa
 mcusy_cn#126.com (请把#改成@) 交流:522422171
本站学习交流群:138..158(高级群1-)、77930286(高级群2)、61804809(群3)
Copyright© MCUSY All Rights Reserved
本站网警备案号: WZ36040002485
  ICP备案证书号:粤ICP备09034963号