单片机音乐盒的课程设计_第1页
单片机音乐盒的课程设计_第2页
单片机音乐盒的课程设计_第3页
单片机音乐盒的课程设计_第4页
单片机音乐盒的课程设计_第5页
已阅读5页,还剩13页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、1.i/o30? 2lcd? 3? 4? 589c514*416*2 lcdledt0t1lcd,led1?p1.0p1.7p1.0p1.3p1.4p1.72?p0.0p0.7p2.0p2.7led,p0.0p0.7a,b,c,d,e,f,g,p2.0p2.73?p2.0p2.2lcdrs,r/w,ep0.0p0.7lcdd0d74?p3.75?12mhzc1,c230pf012?3?45?6?7?89abcde?f? ?proteusrs bit p2.0?;rw bit p2.1e bit p2.2;*l50ms equ 60hl1ms equ 61hl250ms equ 62hsec e

2、qu 65hmin equ 64hhou equ 63h;*org 0000hljmp mainorg 000bhljmp tt0org 001bhljmp t1intorg 1000hmain:;-;mov sp,#70h?mov p0,#01h? ;call enablemov p0,#38h? ;82lcall enablemov p0,#0fh? ;onon,onlcall enablemov p0,#06h? ;1onlcall enable;-lcall initil?;-key1:lcall keylcall modd?ljmp key1;-key:nopnoplcall ksj

3、nz k1? ;k1lcall kaijilcall sopxn:ljmp keyk1:lcall moddlcall moddlcall ksjnz k2ljmp keyk2:mov r2,#0feh? ;mov r4,#00hk3:mov a,r2mov p1,amov a,p1jb acc.4,l1? ;1mov a,#00hljmp lkl1:jb acc.5,l2mov a,#04hljmp lkl2:jb acc.6,l3mov a,#08hljmp lkl3:jb acc.7,next1mov a,#0ch;-lk:add a,r4push acck4:lcall delay1?

4、 ;lcall ksjnz k4;-mov r3,#07h?clr amov r0,#30hmov r1,#31hmm1:mov a,r1mov r0,ainc r0inc r1djnz r3,mm1pop accmov r0,aret;-next1:inc r4? ;-mov a,r2jnb acc.3,n2ljmp n1n2:ljmp keyn1:rl amov r2,aljmp k3;-ks:mov a,#0f0h? ;p1mov p1,anopnopmov a,p1cpl aanl a,#0f0hret;-delay1:setb rs0dl:mov r5,#0ahdl2:mov r6,

5、#63dl3:nopnopdjnz r6,dl3djnz r5,dl2clr rs0?ret;-;30h-37h;-initil:?mov r3,#08hmov r0,#30hm1:mov r0,#00hinc r0djnz r3,m1?ret;-;?;-modd:?mov p0,#8ehlcall enable?mov a,37hmov dptr,#table3?movc a,a+dptrlcall write2?ret;-;-kaiji:mov a,37hcjne a,#0fh,dffmov p0,#80h? ;lcall enablemov dptr,#table1;lcall writ

6、e1?dff:ret;-;-sop:mov a,37hcjne a,#01h,a11lcall moddmov 52h,#high table10mov 53h,#low table10lcall initile2lcall main0a11:cjne a,#02h,a22lcall moddmov 52h,#high table20mov 53h,#low table20lcall initile2?lcall main0a22:cjne a,#03h,a33lcall moddmov 52h,#high table30mov 53h,#low table30lcall initile2?l

7、call main0?a33:cjne a,#04h,a44lcall moddmov 52h,#high table40mov 53h,#low table40lcall initile2?lcall main0a44:cjne a,#05h,a55lcall moddmov 52h,#high table50mov 53h,#low table50lcall initile2?lcall main0a55:cjne a,#06h,a66lcall moddmov 52h,#high table60mov 53h,#low table60lcall initile2?lcall main0?

8、a66:cjne a,#07h,a77lcall moddmov 52h,#high table70mov 53h,#low table70lcall initile2?lcall main0?a77:cjne a,#08h,a88lcall moddmov 52h,#high table80mov 53h,#low table80lcall initile2?lcall main0a88:cjne a,#09h,a99lcall moddmov 52h,#high table90mov 53h,#low table90lcall initile2?lcall main0?a99:cjne a

9、,#0ah,aaalcall moddmov 52h,#high table100mov 53h,#low table100lcall initile2?lcall main0?aaa:ret?;*initile2:mov l50ms,#20mov l1ms,#00hmov l250ms,#00hmov sec,#00hmov min,#00hmov hou,#00hmov a,houmov b,#10div abadd a,#30h? ;bcdasiicmov p0,#0c8h? ;call enablecall write2mov a,badd a,#30hmov p0,#0c9h? ;c

10、all enablecall write2mov a,#3ahmov p0,#0dh? ;call enablecall write2mov a,minmov b,#10div abadd a,#30hmov p0,#0cbh? ;call enablecall write2mov a,badd a,#30hmov p0,#0cch? ;call enablecall write2mov a,#3ahmov p0,#0cdh? ;call enablecall write2mov a,secmov b,#10div abadd a,#30hmov p0,#0ceh? ;call enablec

11、all write2mov a,badd a,#30hmov p0,#0cfh? ;call enablecall write2mov p0,#0c0h? ;call enablemov dptr,#table2;call write1?ret;*enable:clr rsclr rwclr elcall delaysetb eret;*write1:mov r1,#00ha1:mov a,r1movc a,a+dptrcall write2inc r1cjne a,#0feh,a1? ;retwrite2:mov p0,asetb rsclr rwclr ecall delaysetb er

12、et;*delay:mov r4,#05d1:mov r5,#0ffhdjnz r5,$djnz r4,d1ret?;-tab:db 0c0h,0f9h,0a4h,0b0h,99h,92h,82h,0f8hdb 80h,90h,88h,83h,0c6h,0a1h,86h,8ehtab1:db 89h,86h,0c7h,0c7h,0c0htab2:db 0c6h,88h,0c0htable1:dbwelcom here,0fehtable2:dbdff wb ,0fehtable4:db cau,0fehtable3:db 30h,31h,32h,33h?db 34h,35h,36h,37hdb

13、 38h,39h,41h,42hdb 43h,44h,45h,46h?;-;-main0:mov tmod,#11hmov ie,#8ah;mov th1,#3ch;mov tl1,#0b0h?lcall ksjnz ttm12?mov 40h,#00h;-next20:mov a,40hmov dph,52hmov dpl,53hmovc a,a+dptrmov r2,ajz stopanl a,#0fhmov r1,amov a,r2swap aanl a,#0fhjnz singclr tr0jmp w1;-sing:dec amov 22h,arl amov dptr,#table00

14、movc a,a+dptrmov th0,amov 21h,amov a,22hrl ainc amovc a,a+dptrmov tl0,amov 20h,asetb tr0setb? tr1w1:lcall delay30inc 40hlcall ks? ?;-jnz stopljmp next20;-stop:clr tr0clr tr1ljmp main0;-ttm12:lcall k2mov a,37hcjne a,#0eh,ttm13clr tr1lcall delay1ttm120:lcall kslcall delay1jz ttm120lcall k2mov a,37hcjn

15、e a,#0eh,ttm120setb tr1ljmp next20ttm13:cjne a,#0ch,ttm14mov a,52hinc amov 52h,amov a,53hinc amov 53h,amov a,36hinc amov 37h,aljmp ttm2ttm14:cjne a,#0dh,ttm2mov a,52hdec amov 52h,amov a,53hdec amov 53h,amov a,36hdec amov 37h,a;-?ttm2:ret;*;0;*tt0:push accpush pswmov tl0,20hmov th0,21hcpl p3.7pop psw

16、pop accreti;*;1;*t1int:mov th1, #3chmov tl1, #0b0hdjnz l50ms,x4mov l50ms,#20;*-secset:mov a,secmov b,#10div abadd a,#30hmov p0,#0ceh? ;lcall enablelcall write2mov a,badd a,#30hmov p0,#0cfh? ;lcall enablelcall write2mov a,secinc amov sec,axrl a,#60x4:jnz outminset:mov sec,#00h?;*mov a,mininc amov min

17、,amov b,#10div abadd a,#30hmov? p0,#0cbh? ;lcall enablelcall write2mov a,badd a,#30hmov? p0,#0cch? ;lcall enablelcall write2mov a,minmov b,#3mul abmov b,#100div abmov r2,amov a,#10xch a,bdiv abmov a,minxrl a,#60jnz outhouset:mov min,#00h?;*?mov a,houmov b,#10div abadd a,#30h? ;bcdasiicmov p0,#0c8h?

18、;call enablecall write2mov a,badd a,#30hmov p0,#0c9h? ;call enablecall write2mov a,houinc amov hou,axrl a,#10jnz outsjmp overflowout:reti;*overflow:mov l50ms,#20mov l1ms,#00hmov l250ms,#00hmov sec,#00hmov min,#00hmov hou,#00hreti;-delay30:? ?mov r7,#2w2:mov r4,#125w3:mov r3,#248djnz r3,$djnz r4,w3dj

19、nz r7,w2djnz r1,delay30ret;-table00:dw 64580,64684,64777,64820dw 64898,64968,65030,64260dw 64400,64524,65058,63835,64021;-;-table10:? ?db 66h,52h,36h,22h,12h,12h,22h,32h,98h,84h,82h,92h,14h,12h,22hdb 32h,52h,22h,42h,38h,66h,52h,36h,22h,12h,22h,22h,32h,98hdb 24h,22h,32h,54h,52h,32h,92h,12h,92h,82h,98

20、h,66h,52h,36h,22hdb 12h,12h,22h,32h,98h,84h,82h,92h,14h,12h,22h,32h,52h,22h,42h,38hdb 66h,52h,36h,22h,12h,22h,22h,32h,98h,24h,22h,32h,54h,52h,32hdb 22h,12h,92h,82h,98h,14h,24h,34h,44h,64h,0b4h,64h,32h,52hdb 62h,0b2h,62h,52h,38h,24h,22h,32h,54h,52h,62h,52h,32h,32h,22h,38hdb 64h,0b4h,64h,32h,52h,62h,0

21、b2h,62h,52h,38h,22h,22h,22h,32h,52h,52hdb 52h,62h,7fh,74h,04h,58h,6fhdb 00;-;-table20:?db 02h,82hdb 16h,32h,54h,02h,52hdb 0a6h,32h,54h,02h,52hdb 64h,74h,0b6h,64hdb 52h,5ch,32h,22hdb 16h,12h,14h,32h,22hdb 16h,12h,14h,22h,32hdb 26h,12h,94h,22h,32hdb 2chdb 32h,52hdb 36h,22h,14h,54hdb 0ach,92h,0a2hdb 96

22、h,0a2h,96h,82hdb 3ch,54hdb 36h,22h,14h,54hdb 0ach,92h,0a2hdb 16h,12h,14h,22h,32hdb 2ch,02h,82hdb 16h,32h,56h,12hdb 0a6h,32h,56h,52hdb 66h,72h,0b6h,62hdb 62h,52h,58h,32h,22hdb 16h,12h,14h,32h,22hdb 16h,12h,14h,22h,32hdb 26h,92h,0a4h,12h,22hdb 1chdb 00;-;-table30:db 0d4h,84h,94h,82h,92hdb 12h,22h,82h,

23、92h,02h,92h,82h,0d2hdb 82h,92h,14h,84h,02h,0d1h,0d1hdb 0c2h,0d2h,84h,0d2h,0d2h,82h,82hdb 84h,82h,82h,94h,82h,0d2hdb 82h,82h,82h,92h,02h,82h,82h,0d2hdb 0c4h,84h,0d4h,92h,0d2hdb 82h,0d2h,82h,92h,98hdb 04h,94h,88hdb 04h,94h,88hdb 04h,94h,88hdb 04h,94h,88h,04hdb 32h,32h,22h,12h,02h,92h,12h,92hdb 32h,32h

24、,22h,12h,02h,92h,12h,92hdb 32h,32h,22h,12h,02h,92h,12h,22hdb 54h,44h,34h,12h,22hdb 34h,22h,12h,02h,92h,12h,92hdb 32h,32h,22h,12h,02h,92h,12h,92hdb 32h,32h,22h,12h,02h,92h,12h,22hdb 54h,44h,32h,22h,12h,92hdb 00?;-;-table40:db 88h,14h,24h,36h,42h,34h,14h,28h,14h,94hdb 1fh,88h,14h,24h,34h,32h,42h,54h,1

25、4hdb 46h,32h,54h,22h,32h,32h,22h,2ch,38h,54h,74hdb 76h,62h,68h,54h,52h,62h,74h,62h,52h,3fhdb 46h,42h,54h,64h,54h,42h,32h,28h,0a4h,0a2hdb 92h,84h,94h,1fh,0b8h,68h,46h,52h,68hdb 74h,72h,72h,74h,62h,52h,3fh,0b8h,68hdb 46h,52h,68h,64h,62h,62h,64h,42h,32h,2fhdb 58h,14h,24h,36h,42h,34h,12h,12h,26h,22h,24h

26、,22h,12hdb 94h,9ch,0a8h,0a6h,92h,84h,64h,54h,22h,22h,46h,42h,44h,32h,22h,5fhdb 00;-;-table50:db 82h,92h,12h,14h,12h,14h,92h,82h,12h,14h,22h,14h,92h,12h,22h,24hdb 22h,24h,12h,92h,22h,24h,32h,24h,32h,52h,62h,54h,52h,64h,52h,32hdb 22h,32h,22h,12h,94h,82h,92h,12h,14h,12h,14h,94h,1chdb 82h,92h,12h,14h,12

27、h,14h,92h,82h,12h,14h,22h,14h,92h,12h,22h,24hdb 22h,24h,12h,92h,22h,24h,32h,24h,32h,52h,62h,54h,52h,64h,52h,32hdb 22h,32h,22h,12h,94h,82h,92h,12h,14h,12h,14h,22h,12h,1ch,32h,52hdb 62h,64h,62h,64h,0b2h,62h,52h,54h,62h,54h,32h,22hdb 12h,14h,12h,14h,24h,3ch,32h,22h,12h,14h,12h,14h,0b2h,62h,52h,54h,62h,

28、54h,32h,52hdb 66h,0b2h,0b4h,62h,52h,5ch,32h,52h,62h,64h,62h,64h,0b2h,62h,52h,54hdb 62h,54h,32h,22h,12h,14h,12h,14h,54h,3ch,32h,22h,12h,14h,12h,14h,22h,32hdb 52h,54h,32h,54h,32h,52h,6fh,04h,02h,92h,32h,24h,12h,1fhdb 00;-;-table60:db 32h,22h,38h,02h,22h,32h,22h,18h,04h,92h,12h,24h,22h,32h,22h,12h,92h,

29、92h,88h,04h,32h,22hdb 38h,02h,22h,32h,22h,18h,04h,92h,12h,24h,22h,32h,22h,21h,92h,12h,28h,04h,32h,22hdb 38h,02h,22h,32h,22h,18h,04h,92h,12h,24h,22h,32h,22h,12h,92h,91h,11h,88hdb 04h,32h,52h,58h,02h,52h,62h,52h,38h,04h,22h,22h,24h,22h,32h,22h,12h,92h,92hdb 12h,12h,1ch,08h,02h,52h,52h,62h,0b2h,72h,72h

30、,62h,32h,22h,22h,22hdb 38h,02h,32h,32h,52h,64h,64h,02h,92h,32h,22h,28h,04h,32h,52h,52h,32h,54h,02h,0b4h,72hdb 62h,72h,34h,02h,62h,62h,72h,62h,52h,32h,22h,02h,32h,22h,32hdb 58h,02h,52h,52h,62h,0b2h,72h,72h,62h,32h,22h,22h,22hdb 38h,02h,32h,32h,52h,64h,64h,02h,92h,32h,22h,28h,04h,32h,52h,52h,32h,54h,0

31、2h,0b4h,72hdb 62h,72h,34h,02h,62h,62h,72h,62h,52h,32h,22h,02h,84h,92h,1chdb 00;-;-table70:db 66h,52h,34h,54h,0b4h,62h,52h,68h,34h,52h,62h,54h,34h,12h,92h,52h,32h,28hdb 26h,32h,54h,52h,62h,34h,24h,18h,56h,32h,22h,12h,92h,12h,8fhdb 66h,52h,34h,54h,0b4h,62h,52h,68h,34h,52h,62h,54h,34h,12h,92h,52h,32h,2

32、8hdb 26h,32h,54h,52h,62h,34h,24h,18h,56h,32h,22h,12h,92h,12h,8fhdb 66h,52h,34h,54h,0b4h,62h,52h,68h,34h,52h,62h,54h,34h,12h,92h,52h,32h,28hdb 26h,32h,54h,52h,62h,34h,24h,18h,56h,32h,22h,12h,92h,12h,8fhdb 00;-;-table80:db 86h,92h,12h,22h,32h,52h,68h,63h,52h,34h,62h,0b2h,0b2h,62h,51h,61h,51h,31h,54hdb

33、 62h,0b2h,0b2h,62h,52h,32h,52h,52h,51h,61h,51h,31h,34h,52h,62h,74h,32h,52h,52h,32h,21h,31h,21h,11h,24hdb 32h,52h,52h,32h,22h,12h,24h,32h,52h,52h,32h,62h,52h,61h,51h,31h,21h,21h,31h,21h,11h,1chdb 21h,31h,22h,23h,31h,21h,18h,02h,0b2h,0bch,0b4h,72h,61h,51h,72h,61h,71h,61h,51h,61h,71h,61h,6fhdb 86h,94h,

34、12h,22h,32h,52h,64h,62h,51h,31h,52h,21h,31h,21h,33h,62h,0b2h,0b2h,62h,51h,61h,51h,31h,54hdb 62h,0b2h,72h,61h,51h,51h,61h,51h,31h,54h,61h,0b2h,72h,61h,51h,51h,61h,51h,31h,32h,21h,11h,32h,51h,61h,54hdb 02h,32h,24h,32h,52h,52h,32h,22h,31h,21h,11h,24h,32h,52h,62h,0b2h,72h,61h,51h,61h,51h,31h,32h,52h,52h

35、,32h,62hdb 51h,31h,31h,21h,11h,91h,23h,31h,21h,1ch,12h,24h,32h,62h,51h,31h,34h,0b4h,72h,61h,51h,63h,71h,64hdb 0b2h,54h,72h,62h,71h,61h,54h,61h,51h,31h,21h,34h,73h,61h,54h,22h,32h,52h,22h,36h,52h,62h,61h,31h,32h,21h,11h,21h,11h,91h,81hdb 94h,52h,62h,52h,42h,32h,22h,32h,52h,0b4h,74h,64h,52h,61h,51h,41

36、h,5ch,02h,52h,0b4h,74h,63h,51h,61h,51h,31h,21hdb 00;-;-table90:db 02h,11h,21h,32h,32h,22h,32h,21h,11h,0a1h,91h,92h,0d1h,91h,83h,91h,0a2h,91h,81h,94h,11h,0a1h,91h,0a1h,98h,03h,81h,0a1h,0a1h,91h,0a1hdb 98h,04h,02h,11h,21h,32h,32h,22h,32h,21h,31h,51h,11h,13h,31h,22h,22h,21h,11h,0a1h,11h,13h,11h,11h,0a1h,91h,0a1hdb 11h,93h,94h,03h,81h,11h,0a1h,91h,81h,92h,0a1h,91h,94h,08h,03h,81h,32h,21h,11h,22h,31h,21h,21h,83hdb 01h,11h,91h,0a1h,11h,61h,51h,11h,34h,01h,31h,21h,31h,48h,23h,31h,32h,42h,38h,03h,11h,21h,52h,31hdb 33h,31h,31h,41h,51h,61h,23h,21h,21h,41h,31

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论