导航:首页 > 操作系统 > 基于单片机的音乐盒设计

基于单片机的音乐盒设计

发布时间:2023-01-15 11:25:27

单片机音乐盒自己放歌

可以。单片机音乐盒依据单片机技术原理,通过硬件电路制作以及软件编译,设计制作出一个多功能多功能音乐盒,按照生产设定,可以进行自动放歌。单片机又称微控制器,是一种面向控制领域嵌入式应用的集成化计算机芯片,主要用于工业控制、数据处理、信号处理、智能仪器、通信产品及民用消费产品等自动控制产品。

⑵ 急急急!!! 求AT89C51单片机实训制作音乐盒程序编写!以下为电路原理图。谢谢...晶振是12M

OUT BIT P2.3 ;定义音频输出端口,p2.3
N EQU 9 ;歌曲总数
OUT_NUM EQU P0 ;数码管显视当前所放歌曲曲数
ORG 0000H
AJMP MAIN
ORG 0003H
AJMP LAST_SONG ;外部中断0用于接上一曲歌按键
ORG 000BH
AJMP F_T0 ;定时器0用于定时,作音符发生器用
ORG 0013H
q4: AJMP NEXT_SONG ;外部中断1接下一曲歌按键
ORG 001BH
AJMP START_PAUSE ;定时器1用计数,这里用作中断,接开始/暂停键,初值为0ffH,方式2
ORG 0030H
MAIN: MOV SP,#60H
MOV DPTR,#TABLE ;DPRT指向每首歌曲的入口地址的地址。
MOV R0,#30H ;R0中存入数据30H,这里在以30H开始的单元存放每首歌曲的入口地址,其中30H,31H存放
;歌曲的节拍入口地址,32H,33H存放歌曲音符入口地址,每首歌占用四个存储存单元。
MOV R5,#00H ;R5中存放表TABLE中正在执行操作的序号
MOV R6,#1 ;R6存放正在设置入口信息的歌曲数
SET_TAB: MOV A,R5 ;设置每首歌曲的入口信息,存放在以30H开始的存储单元中。
MOVC A,@A+DPTR
MOV @R0,A
INC R5
INC R0
MOV A,R5
MOVC A,@A+DPTR
MOV @R0,A
INC R5
INC R0
MOV A,R5
MOVC A,@A+DPTR
MOV @R0,A
INC R0
INC R5
MOV A,R5
MOVC A,@A+DPTR
MOV @R0,A
INC R0
INC R5
INC R6 ;设置完一首歌曲后,歌曲数加一
CJNE R6,#N+1,SET_TAB ;是否设置完,没有便继续,否则进行下面的操作
;*********************************** 对中断,计数器的相关参数进行设置
MOV TMOD, #61H ;计数器0工作方式1,计数器1工作方式2
MOV TH1,#0FFH ;给计数器1置初值0FFH,又由于是工作方式2,所以
MOV TL1,#0FFH ;计数器计数为1,相当于一外部中断。
SETB ET1 ;允许计数器1中断
SETB ET0 ;允许计数器具0中断
CLR PT0 ;计数器0为低优先级
SETB PT1 ;计数器1为高优先级
SETB IT0 ;外部中断0为跳沿触发
SETB PX0 ;高优先级
SETB IT1 ;外部中断1为跳沿触发
SETB PX1 ;高优先级
SETB EX1 ;允许外部中断1中断
SETB EX0 ;允许外部中断定0中断
SETB EA ;开中断总开关
SETB TR1 ;定时器1开始工作,作中断用
SETB OUT ;音频输出端口初始化
;*********************************** ;设置结束
CLR F0 ;设置F0=0,用来作暂停/播放的标置位用
MOV 22H,#01H ;22H单元中存放正在播放的歌曲编号
MOV DPTR,#OUT_TAB ;将正在播放的歌曲编号送数码管显视
MOV A,22H
MOVC A,@A+DPTR
MOV OUT_NUM,A
MOV R7,#00H ;R7中存放歌曲总信息的入口地址
START0:MOV R4,#00H ;R4存放当前正在播放歌曲的第几个节拍数
MOV R0,#30H ;30H开始的单元中存放歌曲的入口信息
MOV A,R7 ;将歌曲的节拍表的入口地址送到DPTR
ADD A,R0
MOV R0,A
MOV DPH,@R0
INC R0
MOV DPL,@R0
INC R0
MOV A,R4
INC R4
MOVC A,@A+DPTR ;取出第一节拍数,其实第一个节拍不是歌曲的第一个节拍,而是表示几分音符
;****************************************************
MOV 26H,A ;将取出的音符数+节拍数保存在职26H单元中
NEXT: MOV R0,#30H ;开始取出歌曲的第一个数据
MOV A,R7
ADD A,R0
MOV R0,A
MOV DPH,@R0
INC R0
MOV DPL,@R0
INC R0
MOV A,R4
INC R4
MOVC A,@A+DPTR ;放在A中
;****************************
JZ END0 ;若为0,则表示为休止符,不唱,本次音符不唱,
MOV R1,A ;不为0,取出节拍数
ANL A,#0FH
MOV R2,A
MOV A,R1
SWAP A
ANL A,#0FH
JNZ SING ;音符不为0,唱
CLR TR0 ;为0,不唱,关频率发生器
SJMP SING1
SING: DEC A ;开始唱,进行相应的数据处理
MOV R3,A
RL A
MOV DPH,@R0
INC R0
MOV DPL,@R0
INC R0
MOVC A,@A+DPTR
MOV 21H,A
MOV TH0,A
MOV A,R3
RL A
INC A
MOVC A,@A+DPTR
MOV 20H,A
MOV TL0,A
SETB TR0 ;开唱
SING1:LCALL DELAY ;每个音符唱多久
JB F0,FOR ;是否暂停,
AJMP NEXT ;没有暂停,继续
FOR: CLR TR0 ;暂停,不唱
JB F0,$ ;等待播放
AJMP NEXT ;开始播放
END0: CLR TR0 ;不唱
MOV A,22H ;唱完处理
CJNE A,#N,WW ;是不是全部歌曲都唱完
MOV 22H,#01H ;全部唱完,则从第一首开始再唱
MOV R7,#00H
MOV OUT_NUM,#11111001B;数码管显视第一首歌曲编号
AJMP WWW
WW: MOV A,R7 ;没有全部唱完,唱下一首,歌曲的入口信息调整
ADD A,#4
MOV R7,A
INC 22H
CLR EA
PUSH DPH
PUSH DPL
MOV A,22H
MOV DPTR,#OUT_TAB
MOVC A,@A+DPTR
MOV OUT_NUM,A ;数码管显视相应的歌曲编号
POP DPL
POP DPH
WWW: SETB EA
AJMP START0 ;开始下一首的演唱
F_T0: MOV TH0,21H ;定时器0置初值
MOV TL0,20H
CPL OUT ;频率产生
RETI
NEXT_SONG: PUSH ACC ;下一曲中断程序处理,保护现场
PUSH DPH
PUSH DPL
CLR EA ;关中断
MOV A,22H
CJNE A,#N,Q ;是最后一首吗?
MOV R7,#00H ;是最后一首,则R7指向第一首,演唱第一首
MOV 22H,#01H
AJMP BACK
Q: INC 22H ;不是最后一首,唱下一首,R7内容加4,歌曲数加1
MOV A,R7
ADD A,#4
MOV R7,A
BACK: MOV R4,#00H ;数码管显视相应的歌曲编号
MOV A,22H
MOV DPTR,#OUT_TAB
MOVC A,@A+DPTR
MOV OUT_NUM,A
;********************************************
MOV B,R0 ;对下首要演唱的歌曲的几分拍进行调整,同时对R0中的内容进行保护
MOV R4,#00H
MOV R0,#30H
MOV A,R7
ADD A,R0
MOV R0,A
MOV DPH,@R0
INC R0
MOV DPL,@R0
INC R0
MOV A,R4
INC R4
MOVC A,@A+DPTR
MOV 26H,A ;结果存入26H单元中
DEC R4
MOV R0,B ;恢复R0中的内容
;********************************************
POP DPL ;恢复现场
POP DPH
POP ACC
SETB EA
RETI ;中断返回
LAST_SONG: PUSH ACC ;上一曲中断程序处理开始,保护现场
PUSH DPH
PUSH DPL
CLR EA ;关中断
MOV A,22H ;曲目数送A
CJNE A,#1,QQ ;是否是第一首
MOV 22H,#N ;是第一首歌曲
MOV B,#4 ;将R7指向最后一首歌曲
MOV A,#N-1
MUL AB
MOV R7,A
AJMP BACK2 ;处理结束
QQ: DEC 22H
MOV A,R7 ;R7减4
SUBB A,#4
MOV R7,A
BACK2: MOV R4,#00H
MOV A,22H
MOV DPTR,#OUT_TAB
MOVC A,@A+DPTR
MOV OUT_NUM,A ;数码管显视相应歌曲的编号
;********************************************
MOV B,R0 ;对下首要演唱的歌曲的几分拍进行调整,同时对R0中的内容进行保护
MOV R4,#00H
MOV R0,#30H
MOV A,R7
ADD A,R0
MOV R0,A
MOV DPH,@R0
INC R0
MOV DPL,@R0
INC R0
MOV A,R4
INC R4
MOVC A,@A+DPTR
MOV 26H,A ;结果存入26H单元中
DEC R4
MOV R0,B ;R0中的内容恢复
;********************************************
POP DPL ;恢复现场
POP DPH
POP ACC
SETB EA
RETI ;中断返回
START_PAUSE:CPL F0 ;开始/暂停中断处理程序,将标置位取反
JB F0,RETURN ;为1返回
SETB TR0 ;为0则播放
RETURN: RETI ;中断返回
DELAY: MOV 27H,26H ;音符演奏时间控制
D2: MOV 28H,#125
D3: MOV 29H,#248
DJNZ 29H,$
DJNZ 28H,D3
DJNZ 27H,D2
DJNZ R2,DELAY
RET
;OUT_TAB: DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH,77H,7CH,39H,5EH,79H,71H,73H
;共阴数码管显视用
OUT_TAB: DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H,88H,83H,0C6H,0A1H,86H,8EH,0FFH
;共阳
TABLE:
DW SONG1,TABLE1,SONG2,TABLE2,SONG3,TABLE3,SONG4,TABLE4 ,SONG5,TABLE5,SONG6,TABLE6,SONG7,TABLE7,SONG8,TABLE8
TABLE1:DW 64580,64684,64777,64820
DW 64898,64968,65030,64260
DW 64400,64524,65058,63835,64021
SONG1: ;精忠报国
DB 66H,52H,36H,22H,12H,12H,22H,32H,98H,84H,82H,92H,14H,12H,22H
DB 32H,52H,22H,42H,38H,66H,52H,36H,22H,12H,22H,22H,32H,98H
DB 24H,22H,32H,54H,52H,32H,92H,12H,92H,82H,98H,66H,52H,36H,22H
DB 12H,12H,22H,32H,98H,84H,82H,92H,14H,12H,22H,32H,52H,22H,42H,38H
DB 66H,52H,36H,22H,12H,22H,22H,32H,98H,24H,22H,32H,54H,52H,32H
DB 22H,12H,92H,82H,98H,14H,24H,34H,44H,64H,0B4H,64H,32H,52H
DB 62H,0B2H,62H,52H,38H,24H,22H,32H,54H,52H,62H,52H,32H,32H,22H,38H
DB 64H,0B4H,64H,32H,52H,62H,0B2H,62H,52H,38H,22H,22H,22H,32H,52H,52H
DB 52H,62H,7FH,74H,04H,58H,6FH
DB 00

TABLE2:DW 64580,64684,64777,64820
DW 64898,64968,65030,64260
DW 64400,64524,65058,63835,64021
SONG2: DB 02H,82H ;月亮代表我的心
DB 16H,32H,54H,02H,52H
DB 0A6H,32H,54H,02H,52H
DB 64H,74H,0B6H,64H
DB 52H,5CH,32H,22H
DB 16H,12H,14H,32H,22H
DB 16H,12H,14H,22H,32H
DB 26H,12H,94H,22H,32H
DB 2CH
DB 32H,52H
DB 36H,22H,14H,54H
DB 0ACH,92H,0A2H
DB 96H,0A2H,96H,82H
DB 3CH,54H
DB 36H,22H,14H,54H
DB 0ACH,92H,0A2H
DB 16H,12H,14H,22H,32H
DB 2CH,02H,82H
DB 16H,32H,56H,12H
DB 0A6H,32H,56H,52H
DB 66H,72H,0B6H,62H
DB 62H,52H,58H,32H,22H
DB 16H,12H,14H,32H,22H
DB 16H,12H,14H,22H,32H
DB 26H,92H,0A4H,12H,22H
DB 1CH
DB 00
TABLE3: DW 64580,64684,64777,64820
DW 64898,64968,65030,64260
DW 64400,64524,65058,63835,64021
SONG3: DB 0d4H,84H,94H,82H,92H ;看我七十二变
DB 12H,22H,82H,92H,02H,92H,82H,0d2H
DB 82H,92H,14H,84H,02H,0d1H,0d1H
DB 0c2H,0d2H,84H,0d2H,0d2H,82H,82H
DB 84H,82H,82H,94H,82H,0d2H
DB 82H,82H,82H,92H,02H,82H,82H,0d2H
DB 0c4H,84H,0d4H,92H,0d2H
DB 82H,0d2H,82H,92H,98H
DB 04H,94H,88H
DB 04H,94H,88H
DB 04H,94H,88H
DB 04H,94H,88H,04H
DB 32H,32H,22H,12H,02H,92H,12H,92H
DB 32H,32H,22H,12H,02H,92H,12H,92H
DB 32H,32H,22H,12H,02H,92H,12H,22H
DB 54H,44H,34H,12H,22H
DB 34H,22H,12H,02H,92H,12H,92H
DB 32H,32H,22H,12H,02H,92H,12H,92H
DB 32H,32H,22H,12H,02H,92H,12H,22H
DB 54H,44H,32H,22H,12H,92H
DB 00
TABLE4:DW 64580,64684,64777,64820
DW 64898,64968,65030,64260
DW 64400,64524,65058,63835,64021
SONG4:DB 82H,92H,12H,14H,12H,14H,92H,82H,12H,14H,22H,14H,92H,12H,22H,24H ;大海
DB 22H,24H,12H,92H,22H,24H,32H,24H,32H,52H,62H,54H,52H,64H,52H,32H
DB 22H,32H,22H,12H,94H,82H,92H,12H,14H,12H,14H,94H,1cH
DB 82H,92H,12H,14H,12H,14H,92H,82H,12H,14H,22H,14H,92H,12H,22H,24H
DB 22H,24H,12H,92H,22H,24H,32H,24H,32H,52H,62H,54H,52H,64H,52H,32H
DB 22H,32H,22H,12H,94H,82H,92H,12H,14H,12H,14H,22H,12H,1cH,32H,52H
DB 62H,64H,62H,64H,0b2H,62H,52H,54H,62H,54H,32H,22H
DB 12H,14H,12H,14H,24H,3cH,32H,22H,12H,14H,12H,14H,0b2H,62H,52H,54H,62H,54H,32H,52H
DB 66H,0b2H,0b4H,62H,52H,5cH,32H,52H,62H,64H,62H,64H,0b2H,62H,52H,54H
DB 62H,54H,32H,22H,12H,14H,12H,14H,54H,3cH,32H,22H,12H,14H,12H,14H,22H,32H
DB 52H,54H,32H,54H,32H,52H,6fH,04H,02H,92H,32H,24H,12H,1fH
DB 00

TABLE5:DW 64021,64103,64260,64400 ,64524,64580,64684,64777,64820,64898,64968,65030,64934
SONG5:DB 86H,92H,12H,22H,32H,52H,68H,63H,52H,34H,62H,0B2H,0B2H,62H,51H,61H,51H,31H,54H ;彩云追月
DB 62H,0B2H,0B2H,62H,52H,32H,52H,52H,51H,61H,51H,31H,34H,52H,62H,74H,32H,52H,52H,32H,
DB 21H,31H,21H,11H,24H
DB 32H,52H,52H,32H,22H,12H,24H,32H,52H,52H,32H,62H,52H,61H,51H,
DB 31H,21H,21H,31H,21H,11H,1CH
DB 21H,31H,22H,23H,31H,21H,18H,02H,0B2H,0BCH,0B4H,72H,61H,51H,72H,61H,
DB 71H,61H,51H,61H,71H,61H,6FH
DB 86H,94H,12H,22H,32H,52H,64H,62H,51H,31H,52H,21H,31H,21H,33H,62H,0B2H,0B2H,62H,
DB 51H,61H,51H,31H,54H
DB 62H,0B2H,72H,61H,51H,51H,61H,51H,31H,54H,61H,0B2H,72H,61H,51H,51H,61H,51H,31H,32H,
DB 21H,11H,32H,51H,61H,54H
DB 02H,32H,24H,32H,52H,52H,32H,22H,31H,21H,11H,24H,32H,52H,62H,0B2H,72H,61H,51H,61H,
DB 51H,31H,32H,52H,52H,32H,62H
DB 51H,31H,31H,21H,11H,91H,23H,31H,21H,1CH,12H,24H,32H,62H,51H,31H,34H,0B4H,72H,
DB 61H,51H,63H,71H,64H
DB 0B2H,54H,72H,62H,71H,61H,54H,61H,51H,31H,21H,34H,73H,61H,54H,22H,32H,52H,22H,36H,
DB 52H,62H,61H,31H,32H,21H,11H,21H,11H,91H,81H
DB 94H,52H,62H,52H,42H,32H,22H,32H,52H,0B4H,74H,64H,52H,61H,51H,41H,5CH,02H,52H,0B4H,74H,
DB 63H,51H,61H,51H,31H,21H
DB 00
;*******************************************绿岛小夜曲
TABLE6:DW 64021,6103,64260,64400,64524,64580,64624,64777,64820,64898,64958,65030,65058,65110,65157
SONG6: DB 06H
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
DB 0A4H,02H,0B2H,0A4H,84H
DB 72H,82H,72H,62H,72H,84H,72H
DB 64H,62H,12H,34H,02H,42H
DB 38H,38H
DB 44H,02H,32H,44H,64H
DB 72H,82H,72H,62H,72H,84H,0A2H
DB 72H,74H,82H,0A4H,02H,062H
DB 0A8H,0A8H
DB 0B2H,0B4H,0A2H,84H,82H,72H
DB 62H,72H,82H,0A2H,88H
DB 72H,74H,62H,42H,32H,32H,62H
DB 78H,78H
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
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
DB 72H,74H,62H,44H,64H
DB 0A8H,0A4H,02H,0A2H
DB 0A2H,0B1H,0A1H,82H,0A2H,0B4H,0B2H,0C2H
DB 0A2H,0B2H,0A2H,82H,78H
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
TABLE7:
DW 64260,64400,64521,64580
DW 64684,64777,64820,64898
DW 64968,65030,65058,65110
DW 65157,65178,65217
SONG7: ;乐曲名称《梁祝》
DB 02H,82H,62H,52H,48H,02H,52H,32H,22H,18H
DB 83H,91H,72H,62H,51H,61H,71H,61H,83H,61H
DB 81H,51H,61H,71H,61H,51H,46H,82H,32H,52H
DB 22H,42H,16H,21H,41H,18H,0E4H,13H,21H,43H
DB 51H,21H,41H,12H,83H,81H,61H,81H,58H,53H
DB 61H,31H,22H,13H,21H,42H,52H,0E2H,42H,21H
DB 11H,91H,41H,18H,63H,81H,32H,52H,21H,41H,
DB 16H,0E4H,11H,21H,31H,51H,26H,11H,21H,43H
DB 51H,82H,62H,52H,61H,51H,42H,21H,11H,0E4H
DB 44H,21H,41H,21H,11H,0E1H,11H,21H,41H,18H
DB 61H,81H,51H,61H,51H,41H,32H,21H,41H,18H
DB 08H,0H,04H ;曲子最后静音5拍长的时间
DB 00H ;乐曲结束
TABLE8: ;决定音调的定时初值.
DW 64260,64400,64524,64580
DW 64684,64777,64820,64898
DW 64968,65030,65058,65110
DW 65157,65178,65217
SONG8: ;决定音调和节拍的表格,不同的歌曲只是此表不同
DB 82H,01H,81H,94H,84H,0B4H,0A4H,04H,82H,01H,81H,94H,84H,0C4H,0B4H,04H
DB 82H,01H,81H,0F4H,0D4H,0B4H,0A4H,94H,0E2H,01H,0E1H,0D4H,0B4H,0C4H,0B4H,04H
DB 82H,01H,81H,94H,84H,0B4H,0A4H,04H,82H,01H,81H,94H,84H,0C4H,0B4H,04H
DB 82H,01H,81H,0F4H,0D4H,0B4H,0A4H,94H,0E2H,01H,0E1H,0D4H,0B4H,0C4H,0B4H,04H,00
DB 02H,82H,62H,52H,48H,02H,52H,32H,22H,18H
DB 83H,91H,72H,62H,51H,61H,71H,61H,83H,61H
DB 81H,51H,61H,71H,61H,51H,46H,82H,32H,52H
DB 22H,42H,16H,21H,41H,18H,0E4H,13H,21H,43H
DB 51H,21H,41H,12H,83H,81H,61H,81H,58H,53H
DB 61H,31H,22H,13H,21H,42H,52H,0E2H,42H,21H
DB 11H,91H,41H,18H,63H,81H,32H,52H,21H,41H,
DB 16H,0E4H,11H,21H,31H,51H,26H,11H,21H,43H
DB 51H,82H,62H,52H,61H,51H,42H,21H,11H,0E4H
DB 44H,21H,41H,21H,11H,0E1H,11H,21H,41H,18H
DB 61H,81H,51H,61H,51H,41H,32H,21H,41H,18H
DB 08H,0H,04H ;曲子最后静音5拍长的时间
DB 00H ;乐曲结束
END

⑶ 单片机怎么做音乐盒啊

我也在做只是还没做好下面的程序可以实现放1234567的音 如果换成谱子的话也是可以播放的,只是比较烦 还没做谱子
ORG 0000H
LJMP MAIN
ORG 001BH
LJMP YINFU
ORG 0030H
MAIN: MOV TMOD,#11H
SETB ET0
SETB ET1
SETB EA
SETB TR0
SETB TR1
MOV R2,#01H
MOV A,#00H
MOV TH1,#00H
MOV TL1,#00H
L0: MOV TL0,R0
MOV TH0,R1
L1: JNB TF0,L1
CPL P1.2
CPL TF0
SJMP L0

YINFU:MOV TH1,#00H
MOV TL1,#00H
DJNZ R2,L2
MOV R2,#64H
MOV R3,A
MOV DPTR,#CDEF
MOVC A,@A+DPTR
MOV R0,A
MOV A,R3
MOV DPTR,#GAB
MOVC A,@A+DPTR
MOV R1,A
MOV A,R3
INC A
L2: CLR TF0
RETI

CDEF: DB 0B2H,0B2H,026H,026H,0DDH,0DDH,008H,008H,01FH,01FH,017H,017H,088H,088H
GAB: DB 0F2H,0F2H,0F4H,0F4H,0F4H,0F4H,0F6H,0F6H,0F7H,0F7H,0F8H,0F8H,0F8H,0F8H
END

⑷ 求一份C51单片机数字音乐盒(LCD1602显示歌词,歌词需与音乐同步)的课程设计。程序为C语言程序的。

蜂鸣器不能唱歌,只会有调子,不知道显示歌词有什么用,

此外,你给的分太少了,我只给你蜂鸣器唱歌的程序,

一个是单纯的如何让蜂鸣器播放音乐,

一个是红外遥控播放音乐,音乐部分就只在MUSIC.C里面,你看一下就行了,

乐音是由物体振动发出的,如果你的蜂鸣器的发声频率大约等于乐音的频率,那么就能发出类似的调子,具体的音符频率表在我给的PDF的第30页。

再奉送你一个专门单片机编歌谱曲的软件。

⑸ 跪求基于51单片机的汇编语言音乐盒程序

OUT BIT P2.3 //该引脚接蜂鸣器
ORG 0000H
LJMP START
ORG 000BH
INC 20H ;中断服务,中断计数器加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 ;中断计数器清0
MOV B,#00H ;表序号清0
MUSIC1:
NOP
CLR A
MOVC A,@A+DPTR ;查表取代码
JZ END0 ;是00H,则结束
CJNE A,#0FFH,MUSIC5
LJMP MUSIC3
MUSIC5:
NOP
MOV R6,A
INC DPTR
MOV A,B
MOVC A,@A+DPTR ;取节拍代码送R7
MOV R7,A
SETB TR0 ;启动计数
MUSIC2:
NOP
CPL OUT
MOV A,R6
MOV R3,A
LCALL DEL
MOV A,R7
CJNE A,20H,MUSIC2 ;中断计数器(20H)=R7否?
;不等,则继续循环
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 ;歌曲结束,延时1秒后继续
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

⑹ 基于单片机音乐盒的设计

你这个是到网上来找,我就比较呵呵了,既然是毕业设计,就应该到图书馆翻阅资料,我很负责任的说,在图书馆关于音乐盒的单片机设计很多,只要是比较经典的单片机实例的都会有音乐盒,至于仿真,那是最简单的了,只要你的编程及图都出来,正确就可以的。

⑺ 基于单片机的音乐盒设计

是MP3的那种吗

⑻ 基于单片机的音乐播放器的仿真设计外文翻译

单片机音乐盒,这个让我想起了我们刚学单片机时做过的一样东西。
我记得我们原来做课程设计时做过类似的东西
这个仿真我电脑里面至今还保存着
外文翻译我觉得简单啊
不知道你要不要我的帮助呢?

⑼ 用单片机怎么做音乐盒

那就得用单片机编程!
交通信号灯就是单片机编程出来的!(plc)

阅读全文

与基于单片机的音乐盒设计相关的资料

热点内容
奔跑程序员 浏览:466
服务器如何搭建类似github 浏览:290
明日之后安卓太卡怎么办 浏览:502
如何使用命令方块找到村庄 浏览:766
泛函压缩映像原理 浏览:521
win10清除文件夹浏览记录 浏览:964
如何查看服务器域中所有服务 浏览:384
学mastercam91编程要多久 浏览:999
如何查服务器地址和端口 浏览:911
教学云平台app怎么下载 浏览:389
单片机510教学视频 浏览:624
陕西信合app怎么查看自己的存款 浏览:663
风冷冰箱有压缩机 浏览:274
android实现wifi连接wifi 浏览:669
飞猪app怎么帮别人值机 浏览:924
笔记本开我的世界服务器地址 浏览:546
怎样隐藏bat命令 浏览:127
android开发创意 浏览:138
京剧猫为什么进不去服务器 浏览:784
怎么自己免费制作一个手机app 浏览:583