色哟哟视频在线观看-色哟哟视频在线-色哟哟欧美15最新在线-色哟哟免费在线观看-国产l精品国产亚洲区在线观看-国产l精品国产亚洲区久久

您好,歡迎來電子發(fā)燒友網(wǎng)! ,新用戶?[免費(fèi)注冊(cè)]

您的位置:電子發(fā)燒友網(wǎng)>源碼下載>匯編編程>

蜂鳴器奏樂-多種音樂分享

大小:0.1 MB 人氣: 2017-09-06 需要積分:0

1、蜂鳴器奏樂(祝你平安)

ORG 0000H
LJMP START
ORG 000BH
INC 20H ;中斷服務(wù),中斷計(jì)數(shù)器加1
MOV TH0,#0D8H
MOV TL0,#0EFH ;12M晶振,形成10毫秒中斷
RETI
START:
MOV SP,#50H
MOV TH0,#0D8H
MOV TL0,#0EFH
MOV TMOD,#01H
MOV IE,#82H
MUSIC0:
NOP
MOV DPTR,#DAT ;表頭地址送DPTR
MOV 20H,#00H ;中斷計(jì)數(shù)器清0
MOV B,#00H ;表序號(hào)清0
MUSIC1:
NOP
CLR A
MOVC A,@A+DPTR ;查表取代碼
JZ END0 ;是00H,則結(jié)束
CJNE A,#0FFH,MUSIC5
LJMP MUSIC3
MUSIC5:
NOP
MOV R6,A
INC DPTR
MOV A,B
MOVC A,@A+DPTR ;取節(jié)拍代碼送R7
MOV R7,A
SETB TR0 ;啟動(dòng)計(jì)數(shù)
MUSIC2:
NOP
CPL P3.7
MOV A,R6
MOV R3,A
LCALL DEL
MOV A,R7
CJNE A,20H,MUSIC2 ;中斷計(jì)數(shù)器(20H)=R7否?
;不等,則繼續(xù)循環(huán)
MOV 20H,#00H ;等于,則取下一代碼
INC DPTR
; INC B
LJMP MUSIC1
MUSIC3:
NOP
CLR TR0 ;休止100毫秒
MOV R2,#0DH
MUSIC4:
NOP
MOV R3,#0FFH
LCALL DEL
DJNZ R2,MUSIC4
INC DPTR
LJMP MUSIC1
END0:
NOP
MOV R2,#64H ;歌曲結(jié)束,延時(shí)1秒后繼續(xù)
MUSIC6:
MOV R3,#00H
LCALL DEL
DJNZ R2,MUSIC6
LJMP MUSIC0
DEL:
NOP
DEL3:
MOV R4,#02H
DEL4:
NOP
DJNZ R4,DEL4
NOP
DJNZ R3,DEL3
RET
NOP
DAT:
db 26h,20h,20h,20h,20h,20h,26h,10h,20h,10h,20h,80h,26h,20h,30h,20h
db 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
db 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
db 20h,20h,20h,40h,26h,20h,2bh,20h,30h,20h,30h,20h,1ch,20h,20h,20h
db 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,20h,60h,26h,10h,2bh,20h,30h,20h
db 30h,20h,1ch,20h,20h,20h,20h,80h,26h,20h,30h,10h,30h,10h,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
END
?

2、蜂鳴器奏樂(八月桂花香)

;**********************************************************
?? ORG 0000H
?? LJMP START
?? ORG 000BH???????????? ;中斷入口
?? INC 20H?????????????? ;中斷服務(wù)程序,中斷計(jì)數(shù)器加1
?? MOV TH0,#0D8H
?? MOV TL0,#0EFH???????? ;12M晶振,形成10毫秒中斷
?? RETI
START:
?? MOV SP,#50H
?? MOV TH0,#0D8H
?? MOV TL0,#0EFH
?? MOV TMOD,#01H
?? MOV IE,#82H
MUSIC0:
?? NOP
?? MOV DPTR,#DAT??????? ;表頭地址送DPTR
?? MOV 20H,#00H???????? ;中斷計(jì)數(shù)器清0
?? MOV B,#00H?????????? ;表序號(hào)清0
MUSIC1:
?? NOP
?? CLR A
?? MOVC A,@A+DPTR?????? ;查表取代碼
?? JZ END0????????????? ;是00H,則結(jié)束
?? CJNE A,#0FFH,MUSIC5
?? LJMP MUSIC3
MUSIC5:
?? NOP
?? MOV R6,A
?? INC DPTR
?? MOV A,B
?? MOVC A,@A+DPTR?????? ;取節(jié)拍代碼送R7
?? MOV R7,A
?? SETB TR0???????????? ;啟動(dòng)計(jì)數(shù)
MUSIC2:
?? NOP
?? CPL P3.7
?? MOV A,R6
?? MOV R3,A
?? CPL A
?? MOV P1,A???????????? ;顯示(修改者加入的顯示)
?? CPL A
?? LCALL DEL
?? MOV A,R7
?? CJNE A,20H,MUSIC2??? ;中斷計(jì)數(shù)器(20H)=R7否?
??????????????????????? ;不等,則繼續(xù)循環(huán)
?? MOV 20H,#00H???????? ;等于,則取下一代碼
?? INC DPTR
?? LJMP MUSIC1
MUSIC3:
?? NOP
?? CLR TR0????????????? ;休止100毫秒
?? MOV R2,#0DH
MUSIC4:
?? NOP
?? MOV R3,#0FFH
?? LCALL DEL
?? DJNZ R2,MUSIC4
?? INC DPTR
?? LJMP MUSIC1
END0:
?? NOP
?? MOV R2,#64H????????? ;歌曲結(jié)束,延時(shí)1秒后繼續(xù)
MUSIC6:
?? MOV R3,#00H
?? LCALL DEL
?? DJNZ R2,MUSIC6
?? LJMP MUSIC0
DEL:
?? NOP
DEL3:
?? MOV R4,#05H
DEL4:
?? NOP
?? DJNZ R4,DEL4
?? NOP
?? DJNZ R3,DEL3
?? RET
DAT:
DB 18H, 30H, 1CH, 10H
DB 20H, 40H, 1CH, 10H
DB 18H, 10H, 20H, 10H
DB 1CH, 10H, 18H, 40H
DB 1CH, 20H, 20H, 20H
DB 1CH, 20H, 18H, 20H
DB 20H, 80H, 0FFH,20H
DB 30H, 1CH, 10H, 18H
DB 20H, 15H, 20H, 1CH
DB 20H, 20H, 20H, 26H
DB 40H, 20H, 20H, 2BH
DB 20H, 26H, 20H, 20H
DB 20H, 30H, 80H, 0FFH
DB 20H, 20H, 1CH, 10H
DB 18H, 10H, 20H, 20H
DB 26H, 20H, 2BH, 20H
DB 30H, 20H, 2BH, 40H
DB 20H, 20H, 1CH, 10H
DB 18H, 10H, 20H, 20H
DB 26H, 20H, 2BH, 20H
DB 30H, 20H, 2BH, 40H
DB 20H, 30H, 1CH, 10H
DB 18H, 20H, 15H, 20H
DB 1CH, 20H, 20H, 20H
DB 26H, 40H, 20H, 20H
DB 2BH, 20H, 26H, 20H
DB 20H, 20H, 30H, 80H
DB 20H, 30H, 1CH, 10H
DB 20H, 10H, 1CH, 10H
DB 20H, 20H, 26H, 20H
DB 2BH, 20H, 30H, 20H
DB 2BH, 40H, 20H, 15H
DB 1FH, 05H, 20H, 10H
DB 1CH, 10H, 20H, 20H
DB 26H, 20H, 2BH, 20H
DB 30H, 20H, 2BH, 40H
DB 20H, 30H, 1CH, 10H
DB 18H, 20H, 15H, 20H
DB 1CH, 20H, 20H, 20H
DB 26H, 40H, 20H, 20H
DB 2BH, 20H, 26H, 20H
DB 20H, 20H, 30H, 30H
DB 20H, 30H, 1CH, 10H
DB 18H, 40H, 1CH, 20H
DB 20H, 20H, 26H, 40H
DB 13H, 60H, 18H, 20H
DB 15H, 40H, 13H, 40H
DB 18H, 80H, 00H
?? end
?

3、蜂鳴器奏樂(生日快樂)

;本程序?qū)崿F(xiàn)蜂鳴器演奏歌曲功能
;樂曲名稱:生日快樂
;///////////////////////////////////////////
?BUZZER EQU P3.7
?org?0000h??;主程序起始地址
?ajmp?main??;跳至主程序
?org?000bh??;timer0中斷起始地址
?jmp?tim0??;跳至timer0中斷子程序
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
?org?0030h
main:
?mov?tmod,#01h?;設(shè)timer0在MODE1
?mov?ie,#82h??;中斷使能
start0:
?mov?30h,#00h?;取簡(jiǎn)譜碼指針
next:?mov?a,30h??;簡(jiǎn)譜碼指針載入A
?mov?dptr,#table?;至table取簡(jiǎn)譜碼
?movc?a,@a+dptr
?mov?r2,a??;取到的簡(jiǎn)譜碼暫存于R2
?jz?end0??;是否取到00(結(jié)束碼)?
?anl?a,#0fh??;不是,則取低4位(節(jié)拍碼)
?mov?r5,a??;將節(jié)拍碼存入R5
?mov?a,r2??;將取到的簡(jiǎn)譜碼再載入A
?swap?a??;高低四位交換
?anl?a,#0fh??;取低四位(音符碼)
?jnz?sing??;取到的音符碼是否為零?
?clr?tr0??;是,則不發(fā)音
?jmp?d1
sing:?dec?a??;取到的音符碼減1(不含0).
?mov?22h,a??;存入(22H).
?rl?a??;乘2
?mov?dptr,#table1?;至table1取相對(duì)的高位字節(jié)計(jì)數(shù)值
?movc?a,@a+dptr
?mov?th0,a??;取到的高位字節(jié)存入TH0
?mov?21h,a??;取到的高位字節(jié)存入(21H)
?mov?a,22h??;再載入取的的音符碼
?rl?a??;乘2
?inc?a??;加1
?movc?a,@a+dptr?;至table1取相對(duì)的低位字節(jié)計(jì)數(shù)值
?mov?tl0,a??;取到的高位字節(jié)存入TL0??
?mov?20h,a?????????? ;取到的高位字節(jié)存入(20H)
?setb?tr0??;啟動(dòng)timer0
d1:?call?delay??;基本單位時(shí)間1/4拍187毫秒
?inc?30h??;取簡(jiǎn)譜碼指針加1
?jmp?next??;取下一個(gè)碼
end0:?clr?tr0??;停止timer0
?jmp?start0??;重復(fù)循環(huán)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;time0中斷服務(wù)子程序用來產(chǎn)生相應(yīng)的音調(diào)脈沖頻率。
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
tim0:
?push?acc??;將A的值暫存于堆棧
?push?psw??;將psw的值暫存于堆棧
?mov?tl0,20h??;重設(shè)計(jì)數(shù)值
?mov?th0,21h
?cpl?BUZZER??;將蜂鳴器反相
?pop?psw??;至堆棧取回psw的值
?pop?acc??;至堆棧取回a的值
?reti???;返回主程序
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
delay:?mov?r7,#02h??;187毫秒
d2:?mov?r4,#187
d3:?mov?r3,#248
?djnz?r3,$
?djnz?r4,d3
?djnz?r7,d2
?djnz?r5,delay?;決定節(jié)拍
?ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
table1:
?dw?64260,64400,64524,64580
?dw?64684,64777,64820,64898
?dw?64968,65030,65058,65110
?dw?65157,65178,65217
table:
?;1
?db?82h,01h,81h,94h,84h,0b4h,0a4h,04h,82h,01h,81h,94h,84h,0c4h,0b4h,04h
?;2
?db?82h,01h,81h,0f4h,0d4h,0b4h,0a4h,94h,0e2h,01h,0e1h,0d4h,0b4h,0c4h,0b4h,04h
?;3
?db?82h,01h,81h,94h,84h,0b4h,0a4h,04h,82h,01h,81h,94h,84h,0c4h,0b4h,04h
?;4
?db?82h,01h,81h,0f4h,0d4h,0b4h,0a4h,94h,0e2h,01h,0e1h,0d4h,0b4h,0c4h,0b4h,04h,00
?end
?

4、蜂鳴器奏樂

SPK?EQU?P3.7???; 蜂鳴器所在端口
?ORG?0000H
?JMP?START
?
START:
?MOV?R3,#00H
NEXT:
?MOV?A,R3
?MOV?DPTR,#TABLE
?MOVC?A,@A+DPTR
?JZ?START
?MOV?R7,A
?INC?R3
?MOV?A,R3
?MOVC?A,@A+DPTR
?MOV?R2,A
?ACALL?SONG
?INC?R3
?SJMP?NEXT

;===============================================================================?
;===? 歌曲播放子程序 ===
SONG:
?MOV?A,R2?????; 取出節(jié)拍
?RL?A
?JNZ?KEEP
?MOV?A,#01H
KEEP:
?MOV?R2,A
REPEAT:
?ACALL?EIGHTH
?DJNZ?R2,REPEAT
?RET
?
;===============================================================================?
;===? 產(chǎn)生1/8拍延時(shí)子程序? ===??
EIGHTH:
?MOV?A,R7?????; 查表取出廷時(shí)參數(shù),保存到R4
?MOV?DPTR,#DELAY_T
?MOVC?A,@A+DPTR
?MOV?R4,A
?MOV?A,R7?????; 查表取出1/8拍周期數(shù),保存到R5
?MOV?DPTR,#S_PARA
?MOVC?A,@A+DPTR
?MOV?R5,A
NEXTCYC:
?ACALL?SOUND
?DJNZ?R5,NEXTCYC
?RET
?
;===============================================================================?
;===? 發(fā)聲子程序 ===?
SOUND:
?SETB?SPK
?ACALL?SDELAY
?CLR?SPK
?ACALL?SDELAY
?RET
?
;===============================================================================?
;===? 延時(shí)子程序? ===
SDELAY:
?MOV?A,R4?????; 廷時(shí)值在R4內(nèi)
?MOV?R0,A
XL2:
?MOV?R1,#03H
DL1:
?NOP
?DJNZ?R1,DL1
?DJNZ?R0,XL2
?RET
;===============================================================================?
;===? 1/8拍周期表? ===
S_PARA:
?DS?1DH
?DB?15H,16H,00
?DB?19H,00H,1CH,00H,1FH,21H,00H,25H
?DB?00H,29H,2CH,00H,31H,34H,37H,00H
?DB?3EH,41H,00H,49H,00H,52H,57H,00H
?DB?62H
?
;===============================================================================?
;===? 延時(shí)參數(shù)表? ===
DELAY_T:
?DS?1DH
?DB?7EH,77H,00H
?DB?6AH,00H,5EH,00H,54H,4FH,00H,46H
?DB?00H,3FH,3BH,00H,35H,32H,2FH,00H
?DB?2AH,27H,00H,23H,00H,1FH,1DH,0C0H
?DB?1AH
?
;===============================================================================?
;===? 歌曲表? ===
TABLE:
?DW?2202H,2902H,2902H,2902H,2906H,2702H?;我從山中來
?DW?2502H,2702H,2502H,2402H,2208H??;帶著蘭花草
?DW?2E02H,2E02H,2E02H,2E02H,2E06H,2C02H?;種在小園中
?DW?2902H,2C02H,2D02H,2A02H,2908H??;祈禱花開早
?DW?2902H,2E02H,2E02H,2C02H,2906H,2702H?;一日看三回
?DW?2502H,2702H,2502H,2402H,2206H,1D02H?;看得花時(shí)過
?DW?1D02H,2502H,2502H,2402H,2206H,2902H?;蘭花卻依然
?DW?2702H,2502H,2402H,2002H,2208H??;苞也無(wú)一個(gè)
?DW?0000H?????;
?
?END?

非常好我支持^.^

(0) 0%

不好我反對(duì)

(0) 0%

      發(fā)表評(píng)論

      用戶評(píng)論
      評(píng)價(jià):好評(píng)中評(píng)差評(píng)

      發(fā)表評(píng)論,獲取積分! 請(qǐng)遵守相關(guān)規(guī)定!

      ?
      主站蜘蛛池模板: 亚色九九九全国免费视频| 99re2.久久热最新地址| 古代荡女丫鬟高H辣文纯肉| 三级黄色在线观看| 日本调教网站| 国产成A人片在线观看| 亚洲精品久久久久久久蜜臀老牛 | 99er热精品视频国产免费| 欧美午夜特黄AAAAAA片| 国产精品久久久久a影院| 日本福利片午夜免费观着| 国产精品成人影院| 一个人看www| 精品国产福利一区二区在线| 最近2019中文字幕免费版视频| 欧美久久综合性欧美| 国产三级级在线电影| 999久久久国产精品蜜臀AV| 无码99久热只有精品视频在线| 久久亚洲精品无码A片大香大香 | 国产 日韩 欧美 高清 亚洲| 亚洲影院在线播放| 久草在线福利资站免费视频| av56788成 人影院| 亚洲精品在线看| 日本无码人妻精品一区二区视频| 极品虎白在线观看| 大伊人青草狠狠久久| 最近中文字幕2019免费版日本| 翁公吮她的花蒂和奶水| 嫩B人妻精品一区二区三区| 国产亚洲精品久久久久久鸭绿欲| 午夜福利体验免费体验区| 美女张开腿露尿口给男人亲| 99re 这里只有精品| 亚洲精品成人| 日本高清无卡码一区二区久久 | 国精产品一区二区三区有限公司 | yellow在线观看免费观看大全| 亚洲精品第五页中文字幕| 日韩亚洲国产中文字幕欧美|