单片机驱动蜂鸣器播放音乐。

*/

SPKbitP2.3

ORG 0000H

LJMP启动

ORG 000BH

INC 20H中断服务,中断计数器加1。

MOV TH0,#0D8H

MOV TL0,# 0EFH12M晶振,形成10ms中断。

雷蒂

开始:

MOV SP,#50H

MOV TH0,#0D8H

MOV TL0,#0EFH

MOV TMOD,#01H

MOV IE,82H号

音乐0:

nototherwiseprovided(for)除非另有规定

MOV·DPTR,# DAT发送到DPTR的标题地址

MOV 20H,# 00H中断计数器被清零。

MOV B,# 00H表序列号被清除为0。

音乐1:

nototherwiseprovided(for)除非另有规定

CLR A

MOVC A,@ A+DPTR;查找表以获取代码

JZ end 0;如果是00H,就结束了。

CJNE A # 0 ffh音乐5

LJMP音乐3

音乐5:

nototherwiseprovided(for)除非另有规定

MOV·R6

DPTR公司

MOV A,B

MOVC A,@ A+DPTR;取拍码并发送给R7。

MOV R7,A

SETB TR0;开始计数

音乐2:

nototherwiseprovided(for)除非另有规定

SPK下士

R6 MOV

MOV R3,A

LCALL DEL

MOV A,R7

CJNE A,20H,MUSIC2中断计数器(20H)=R7否?

;如果没有,继续循环。

MOV 20H,# 00H等于,则采用下一个代码。

DPTR公司

;公司B

LJMP音乐1

音乐3:

nototherwiseprovided(for)除非另有规定

CLR TR0暂停100毫秒

MOV R2,#0DH

音乐4:

nototherwiseprovided(for)除非另有规定

MOV R3,#0FFH

LCALL DEL

DJNZ R2,音乐4

DPTR公司

LJMP音乐1

END0:

nototherwiseprovided(for)除非另有规定

MOV·R2,64H歌曲结束后,延迟1秒后继续。

音乐6:

MOV R3,#00H

LCALL DEL

DJNZ R2,音乐6

LJMP音乐0

德尔:

nototherwiseprovided(for)除非另有规定

DEL3:

MOV R4,#02H

DEL4:

nototherwiseprovided(for)除非另有规定

DJNZ R4,DEL4

nototherwiseprovided(for)除非另有规定

DJNZ R3,DEL3

浸水使柔软

nototherwiseprovided(for)除非另有规定

日期:

db 26h,20h,20h,20h,20h,20h,26h,10h,20h,10h,20h,80h,26h,20h,30h,20h

数据库30h,20h,39h,10h,30h,10h,30h,80h,26h,20h,20h,20h,20h,20h,1ch,20h

db 20h,80h,2bh,20h,26h,20h,20h,20h,2bh,10h,26h,10h,2bh,80h,26h,20h

数据库30h,20h,30h,20h,39h,10h,26h,10h,26h,60h,40h,10h,39h,10h,26h,20h

db 30h,20h,30h,20h,39h,10h,26h,10h,26h,80h,26h,20h,2bh,10h,2bh,10h

db 2bh,20h,30h,10h,39h,10h,26h,10h,2bh,10h,2bh,20h,2bh,40h,40h,20h

db 20h,10h,20h,10h,2bh,10h,26h,30h,30h,80h,18h,20h,18h,20h,26h,20h

数据库20h,20h,20h,40h,26h,20h,2bh,20h,30h,20h,30h,20h,1ch,20h,20h,20h

数据库20h,80h,1ch,20h,1ch,20h,1ch,20h,30h,20h,30h,60h,39h,10h,30h,10h

db 20h,20h,2bh,10h,26h,10h,2bh,10h,26h,10h,26h,10h,2bh,10h,2bh,80h

db 18h,20h,18h,20h,26h,20h,20h,20h,60h,26h,10h,2bh,20h,30h,20h

数据库30h,20h,1ch,20h,20h,20h,80h,26h,20h,30h,10h,30h,10h,30h,30h,20h

db 39h,20h,26h,10h,2bh,10h,2bh,20h,2bh,40h,40h,10h,40h,10h,20h,10h

db 20h,10h,2bh,10h,26h,30h,30h,80h,00h

结束