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

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

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

單片機之匯編語言會唱歌

大小:0.1 MB 人氣: 2017-09-06 需要積分:0
? ? ?DATA1?? EQU?? 30H?????? ;
?DATA2?? EQU?? 31H?????? ;
?SP1???? EQU?? P3.7????? ;
;-----------------------------------------------------????????
??ORG???? 0000H?????????? ;
?LJMP??? START?????????? ;
?ORG???? 000BH?????????? ;
?INC???? DATA1?????????? ;中斷服務(wù),中斷計數(shù)器加1
?MOV???? TH0,#0DBH?????? ;
?MOV???? TL0,#0FEH?????? ;11.0592M晶振,形成10毫秒中斷
?RETI??????????????????? ;
;---------------------------------------------------
START:
?CPL???? SP1???????????? ;
?MOV???? SP,#50H???????? ;
?MOV???? TH0,#0DBH?????? ;
?MOV???? TL0,#0FEH?????? ;
?MOV???? TMOD,#01H?????? ;
?MOV???? IE,#82H???????? ;
VOICE0:
?NOP???????????????????? ;
?MOV???? DPTR,#TABLE???? ;表頭地址送DPTR
?MOV???? DATA1,#00H????? ;中斷計數(shù)器清0
?MOV???? DATA2,#00H????? ;表序號清0
VOICE1:
?NOP???????????????????? ;???
?CLR???? A?????????????? ;
?MOVC??? A,@A+DPTR?????? ;查表取代碼???????
?JZ????? EXIT_END??????? ;是00H,則結(jié)束
?CJNE??? A,#0FFH,VOICE5? ;??????
?LJMP??? VOICE3????????? ;
VOICE5:??????
?NOP???????????????????? ;
?MOV???? R6,A??????????? ;??
?INC???? DPTR??????????? ;?????????
?MOV???? A,DATA2???????? ;????
?MOVC??? A,@A+DPTR?????? ;取節(jié)拍代碼送R7
?MOV???? R7,A??????????? ;????
?SETB??? TR0???????????? ;啟動計數(shù)
VOICE2:??????
?NOP???????????????????? ;
?CPL???? P3.7??????????? ;????
?MOV???? A,R6??????????? ;
?MOV???? R3,A??????????? ;???
?LCALL?? DELAY?????????? ;
?MOV???? A,R7??????????? ;????
?CJNE??? A,DATA1,VOICE2? ;中斷計數(shù)器(20H)=R7否?
????;不等,則繼續(xù)循環(huán)
?MOV???? DATA1,#00H????? ;等于,則取下一代碼???????
?INC???? DPTR??????????? ;????
?LJMP??? VOICE1????????? ;
VOICE3:????????
?NOP???????????????????? ;
?CLR???? TR0???????????? ;休止100毫秒
?MOV???? R2,#0DH???????? ;
VOICE4:?????????
?NOP???????????????????? ;???????
?MOV???? R3,#0FFH??????? ;???????
?LCALL?? DELAY?????????? ;???
?DJNZ??? R2,VOICE4?????? ;?????
?INC???? DPTR??????????? ;??
?LJMP??? VOICE1????????? ;
;--------------------------------------------------
EXIT_END:????????
?NOP????????
?MOV???? R2,#64H???????? ;歌曲結(jié)束,延時1秒后繼續(xù)
VOICE6:????????
?MOV???? R3,#00H???????? ;??????
?LCALL?? DELAY?????????? ;
?DJNZ??? R2,VOICE6?????? ;???????
?LJMP??? VOICE0????????? ;
;--------------------------------------------------
DELAY:???????
?NOP???????????????????? ;
DEL3:?
??????? MOV???? R4,#02H???????? ;
DEL4:?
?NOP???????????????????? ;
?DJNZ??? R4,DEL4???????? ;??????
?NOP???????????????????? ;
?DJNZ??? R3,DEL3???????? ;???????
?RET???????????????????? ;??????????????
;-------------------------------------------------?
TABLE:???
?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
?
?

2、單片機播放歌曲《蘭花草》

?*******************************************************???
??????? 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拍延時子程序? ===??
EIGHTH:
?MOV?A,R7?????; 查表取出廷時參數(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
?
;===============================================================================?
;===? 延時子程序? ===
SDELAY:
?MOV?A,R4?????; 廷時值在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ù)表? ===
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?;看得花時過
?DW?1D02H,2502H,2502H,2402H,2206H,2902H?;蘭花卻依然
?DW?2702H,2502H,2402H,2002H,2208H??;苞也無一個
?DW?0000H?????;
?
?END?
?

非常好我支持^.^

(0) 0%

不好我反對

(0) 0%

      發(fā)表評論

      用戶評論
      評價:好評中評差評

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

      ?
      主站蜘蛛池模板: 国产精品午夜小视频观看| 日本午夜视频在线| 亚洲精品美女久久777777| 娇小XXXXX第一次出血| 亚洲中文字幕欧美自拍一区| 久久久性色精品国产免费观看| 999久久久国产| 忘忧草日本在线WWW日本| 精品欧美小视频在线观看| 99视频精品全部免费免费观 | 精品无码国产污污污免费网站2| 有码在线播放| 日本性xxx| 极品网红液液酱粉嫩福利照子凌酱| 中字幕久久久人妻熟女天美传媒 | 一品道门免费高清视频| 欧美极限变态扩张video| 国产情侣真实露脸在线| 70岁妇女牲交色牲片| 小便japanesewctv| 女配穿书病娇被强啪h| 三级网站视频在线观看| 国产在线精彩亚洲久久| brazzers巨臀系列| 亚洲精品一线二线三线无人区| 男人天堂黄色| 黑人干日本美女| 成人无码精品一区二区在线观看| 亚洲片在线观看| 色综合色综合久久综合频道| 久久久久综合网久久| 国产精品99久久久久久宅男AV| 5G在线观看免费年龄确认| 亚洲成人黄色在线| 人妻少妇偷人精品无码洋洋AV| 白丝美女被狂躁免费漫画| 亚洲精品高清视频| 色婷婷国产麻豆AV| 欧美大香线蕉线伊人久久| 精品久久伊人| 国产美女视频一区二区二三区 |