导航:首页 > 操作系统 > 单片机汇编语言音乐

单片机汇编语言音乐

发布时间:2023-05-11 13:24:28

㈠ 如何编写51单片机音乐程序

设计的相关音乐说明

要产生音频脉冲,只要算出某一音频的周期(1/频率),然后将此周期除以2,即为半周期时间。利用半周期时间定时这个半周期时间,每当计时到后就将输出的I/O反向,然后重复计时此半周期再对I/O反向,就可以在I/O脚上得到此频率的脉冲。

记数脉冲值与频率的关系公式如:N=Fi/2/Fr。N:记数值;Fi:内部计时依次为1us,故其频率为1 MHZ;Fr:要产生的频率。

其记数值的求法如:T=65536-N=65536-Fi/2/Fr。例:设K=65536,F=1000000=Fi=1 MHZ。求低音DO(26HZ),中音DO(523HZ),高音DO(1046HZ)的记数值。

每个音符使用1个音节,字节的高四位代表音符的高低,低四位代表音符的节拍。如果1拍为0.4秒,1/4拍为0.1秒,假设1/4拍为 DELAY,则1拍为4 DELAY。

(1)单片机汇编语言音乐扩展阅读

功能特性

1,可以仿真63K程序空间,接近64K 的16位地址空间;

2,可以仿真64Kxdata 空间,全部64K 的16位地址空间;

3,可以真实仿真全部32 条IO脚;

4,完全兼容keilC51 UV2 调试环境,可以通过UV2 环境进行单步,断点, 全速等操作;

5,可以使用C51语言或者ASM汇编语言进行调试 ;

6,可以非常方便地进行所有变量观察,包括鼠标取值观察,即鼠标放在某 变量上就会立即显示出它此的值;

7,可选 使用用户晶振,支持0-40MHZ晶振频率;

8,片上带有768字节的xdata,您可以在仿真时选 使用他们,进行xdata 的仿真;

9,可以仿真双DPTR 指针;

10,可以仿真去除ALE 信号输出. ;

11,自适应300-38400bps 的所有波特率通讯;

12,体积非常细小,非常方便插入到用户板中.插入时紧贴用户板,没有连接电缆,这样可以有效地减少运行中的干扰,避免仿真时出现莫名其妙的故障;

13,仿真插针采用优质镀金插针,可以有效地防止日久生锈,选择优质园脚IC插座,保护仿真插针,同时不会损坏目标板上的插座. ;

14,仿真时监控和用户代码分离,不可能产生不能仿真的软故障;

15,RS-232接口不计成本采用MAX202集成电路,串行通讯稳定可靠,绝非一般三极管的简易电路可比。

㈡ 单片机怎么实现演奏两首歌(生日快乐+两只老虎) 汇编语言

;音乐生日快乐的播放
numtim equ 20h
EQUei equ 21h
EQUwei equ 22h
EQUnled equ 23h
EQU 000hORGp startJMPg 00bh
jORGtim0
oJMP100h
ORGart:; JB P3.7,$ ;检测播放按键是否按下
mov tmod,#00000001b
MOV mov ie,#10000010b
MOV mov numtim,#01h
startMOVov 30h,#00h

nextMOVv a,30h
mov MOVr,#table
MOVovc a,@a+dptr
mov r2,a
jz eMOV
anl aJZ0fh
mov r5,a
mov aMOV
swap MOV anl a,#0fh
jnz sing
clr tJNZ
jmp d1
sing: dec aJMP mov 22h,DEC rl aMOV mov dptr,#table1
MOVmovc a,@a+dptr
mov th0,a
mov MOV,a
mov MOV2h
rl aMOV inc a
movc a,@INCptr
mov tl0,a
mov MOV,a
setbMOV0
d1:lcall delay
inc 30h
jmp neINC
end0:clr JMP
jmp start0
tim0:puJMPacc
pushPUSH
mov PUSH2PSW
MOV th0,21h
MOV p1.6 ;由该口输出音频数据
pop psw
pop acc
POPrPSW

dPOPy: mov r7,#02h
d2: mov r4,#1MOV
d3: mov r3,#MOV
djnz r3,MOV djnz r4,d3
djnz r7,d2
djnz r5,delay
ret
table1: RET ;音乐码表
dw 64260,64400,64524,64580
DW dw 64684,64777,64820,64898
DW dw 64968,65030,65058,65110
DW dw 65157,65178,65217
table:dDW82h,01h,81h,94h,84h
DB 0b4h,0a4h,04h
db 82hDB1h,81h,94h,84h
DB 0c4h,0b4h,04h

db 8DB,01h,81h,0f4h,0d4h
DBdb 0b4h,0a4h,94h
db 0e2DB01h,0e1h,0d4h,0b4h
DB db 0c4h,0b4h,04h

db 8DB,01h,81h,94h,84h
DB 0b4h,0a4h,04h
db 82hDB1h,81h,94h,84h
DB 0c4h,0b4h,04h

db 8DB,01h,81h,0f4h,0d4h
DBdb 0b4h,0a4h,94h
db 0e2DB01h,0e1h,0d4h,0b4h
DB db 0c4h,0b4h,04h
db 00DB
TABLE2:DB 0C0H,0F9H,DB4H,0B0H,99H,92H,8DB,0F8H,80H,90H
end

END

我只有生日快乐的程序,希望对你有帮助,从我这个程序你了解了原理,你就可以随意搞了,玩熟悉了就简单了!

㈢ 单片机设计音乐播放器程序和仿真图(用汇编语言)急求~谢谢!!!

NUMEQU30H
UPEQUP3.6
DNEQUP3.7
ORG0000H
AJMPSTART;Fosc=12MHz
ORG000BH;T0中断入口地址
AJMPINT_T0
ORG001BH;T1中断入口地址
AJMPINT_T1

START:
MOVSP,#60H
MOVTMOD,#11H
MOVIE,#8AH
MOVIP,#08H ;T1中断优先于T0中断
MOV TH1,#3CH
MOV TL1,#0BH ;以上为系统初始化,T=60ms

W1: MOV P2,#01110001B;等待提示"F" ,01110001
LCALL GETKEY
CJNEA,#0FFH,W1
MOVA,B
CJNEA,#0AH,W2
LCALLKEY_A;输入键是'A',转KEY_A
SJMP W1

W2: CJNE A,#0BH,W3
LCALLKEY_B;输入键是'B',转KEY_B

W3: CJNE A,#0CH,W4
LCALLKEY_C;输入键是'C',转KEY_C
W4: CJNE A,#0DH,W5
LCALLKEY_D
SJMP W1;输入键是'D',转KEY_D
W5: CJNEA,#0EH,W6 ;下一首
INCNUM
MOVA,NUM
CJNEA,#4,W51
W51:
JCW52
MOVNUM,#0
W52:
MOVA,NUM
SJMPD0
W6: CJNEA,#0FH,W7 ;上一首
MOVA,NUM
JNZW61
MOVNUM,#4
W61:
DECNUM
MOVA,NUM
SJMPD0
W7:
SJMP W1
KEY_A:;从1~4按顺序播放
LCALL MUSIC1;乐曲《我和你》
LCALL MUSIC2;乐曲《万水千山总是情》
LCALL MUSIC3;乐曲《送别》
LCALL MUSIC4;乐曲《北京欢迎您》
RET
KEY_B:;从1~4循环播放
T11: LCALL KEY_A
SJMP T11
RET
KEY_C:;循环播放某一乐曲
T3: LCALL GETWORD
CJNE A,#0FFH,T3
MOV A,B
D0:
JNZD1
SJMP E0
D1: DECA
JNZD2
SJMP E1
D2: DECA
JNZE3
SJMP E2
E0: LCALL MUSIC1;乐曲《我和你》
SJMP E0
E1: LCALL MUSIC2;乐曲《万水千山总是情》
SJMP E1
E2: LCALL MUSIC3;乐曲《送别》
SJMP E2
E3: LCALL MUSIC4;乐曲《北京欢迎您》
SJMP E3
RET
KEY_D:;从某一乐曲开始播放,播放完后停止
T2: LCALL GETWORD
CJNE A,#0FFH,T2
MOV A,B
CJNE A,#00H,B1
SJMP C0
B1: CJNE A,#01H,B2
SJMP C1
B2: CJNE A,#02H,C3
SJMP C2
C0: LCALL MUSIC1;乐曲《我和你》
C1: LCALL MUSIC2;乐曲《万水千山总是情》
C2: LCALL MUSIC3;乐曲《送别》
C3: LCALL MUSIC4;乐曲《北京欢迎您》
RET
MUSIC1:;第一首《我和你》
MOVP2,#00000110B ;显示1,00000110
MOVR5,#11111001B
MOV52H,#HIGHTABLE10
MOV53H,#LOWTABLE10
MOVNUM,#0
LCALLmusic
RET
MUSIC2: ;第二首《万水千山总是情》
MOV P2,#01011011B ;显示2,01011011
MOV R5,#10100100B
MOV52H,#HIGHTABLE20
MOV53H,#LOWTABLE20
MOVNUM,#1
LCALL music
RET
MUSIC3: ;第三首《送别》
MOV P2,#01001111B ;显示3,01001111
MOV R5,#10110000B
MOV52H,#HIGHTABLE30
MOV53H,#LOWTABLE30
MOVNUM,#2
LCALL music
RET
MUSIC4: ;第四首《北京欢迎您》
MOV P2,#01100110B ;显示4,01100110
MOV R5,#10011001B
MOV52H,#HIGHTABLE40
MOV53H,#LOWTABLE40
MOVNUM,#3
LCALL music
RET
music: MOVR3,#00H ;音乐解码器
NEXT20:
MOVA,P3
ORLA,#0C0H
MOVP3,A
MOVA,P3
CPLA
ANLA,#0C0H
JZNEXT21
POPACC
POPACC
LJMPW1
RET
NEXT21:
MOVA,R3
MOV DPH,52H
MOV DPL,53H
MOVC A,@A+DPTR
MOV R2,A
JZ STOP
ANL A,#0FH
MOV R1,A
MOV A,R2
SWAP A
ANL A,#0FH
JNZ SING
CLR TR0
JMP W11
;----------------------------------------------------------
SING:
DEC A
MOV22H,A
RL A
MOVDPTR,#TABLE00
MOVC A,@A+DPTR
MOV TH0,A
MOV 21H,A
MOV A,22H
RL A
INC A
MOVC A,@A+DPTR
MOV TL0,A
MOV 20H,A
SETB TR0
SETB TR1
W11:
LCALL DELAY3
INC R3
LJMP NEXT20
;-----------------------------------------------------------
STOP:
CLR TR0
CLR TR1
RET
;***************************************************
;定时器0中断子程序
;***************************************************
INT_T0:
CLR TR0
MOV TL0,20H
MOV TH0,21H
CPL P3.0
SETB TR0
RETI
;***************************************************
;定时器1中断子程序
;***************************************************
INT_T1:
CLRTR1
CLRTR0
LCALL KEY_E
MOVTH1,#3CH
MOVTL1,#0BH
DJNZ 60H,OUT
MOV 60H,#20
OUT:
SETB TR1
RETI
KEY_E:
JB P3.1,L2 ;中断键盘检测
LCALL DELAY2 ;消除抖动
JB P3.1,L2 ;如果是高电平就跳到L2
JNBP3.1,$ ;如果仍然是低电平就执行中断程序
MOV P2,#0111100B ;让LED显示E,01111001
L3: JB P3.1,$ ;检测低电平,直到低电平时才跳出该指令
LCALL DELAY2
JB P3.1,L3
JNBP3.1,$ ;如果再来一个高电平才跳出中断
MOV P2,R5
L2: SETBTR0
RET
GETKEY: ;读ABCD键盘子程序
SA: JB P1.0,SB ;读A,是高电平表示没有按键,跳转到SB
LCALL DELAY2
JB P1.0,SA
JNB P1.0,$
MOV P2,#01110111B ;显示A,01110111
MOV R5,#10001000B
MOV A,#0FFH
MOV B,#0AH
RET
SB: JB P1.1,C11 ;读B,是高电平表示没有按键按下,跳转到C11
LCALL DELAY2
JB P1.1,SB
JNB P1.1,$
MOV P2,#01111100B ;显示B,01111100
MOV R5,#10000011B
MOV A,#0FFH
MOV B,#0BH
RET
C11:JB P1.2,ED1 ;读C
LCALL DELAY2
JB P1.2,C11
JNBP1.2,$
MOV P2,#00111001B ;显示C,00111001
MOV R5,#11000110B
MOV A,#0FFH
MOV B,#0CH
RET
ED1:
JB P1.3,L0 ;读D
LCALL DELAY2
JB P1.3,ED1
JNBP1.3,$
MOV P2,#01011110B ;显示D,01011110
MOV R5,#10100001B
MOV A,#0FFH
MOV B,#0DH
L0: JBUP,L01
LCALLDELAY2
JBUP,L01
JNBUP,$
MOVA,#0FFH
MOVB,#0EH
RET
L01:
JBDN,L02
LCALLDELAY2
JBDN,L02
JNBDN,$
MOVA,#0FFH
MOVB,#0FH
L02:
RET
GETWORD:;读音乐序号子程序
S1: JB P1.4,S2 ;读1键
LCALL DELAY2
JB P1.4,S1
JNB P1.4,$
MOV P2,#00000110B ;显示1
MOV R5,#11111001B
MOV A,#0FFH
MOV B,#00H
RET
S2: JB P1.5,S3 ;读2键
LCALL DELAY2
JB P1.5,S2
JNB P1.5,$
MOV P2,#01011011B ;显示2
MOV R5,#10100100B
MOV A,#0FFH
MOV B,#01H
RET
S3: JB P1.6,S4 ;读3键
LCALL DELAY2
JB P1.6,S3
JNB P1.6,$
MOV P2,#01001111B ;显示3
MOV R5,#10110000B
MOV A,#0FFH
MOV B,#02H
RET
S4: JB P1.7,L1 ;读4键
LCALL DELAY2
JB P1.7,S1
JNB P1.7,$
MOV P2,#01100110B ;显示4
MOV R5,#10011001B
MOV A,#0FFH
MOV B,#03H
L1: RET
DELAY:;延时子程序
PUSH0;保存现场
PUSH1
MOV0,#0H
DELAY1:MOV1,#0H
DJNZ1,$
DJNZ0,DELAY1
POP1;恢复现场
POP0
RET
DELAY2: MOV 41H,#100 ;延时子程序2
F1: MOV 42H,#250
DJNZ 42H,$
DJNZ 41H,F1
RET
DELAY3: ;延时子程序3
MOV R7,#2
W22: MOV R4,#125
W33: MOV R0,248
DJNZ R0,$
DJNZ R4,W33
DJNZ R7,W22
DJNZ R1,DELAY3
RET
TABLE00: ;频率表
DW64260,64400,64524,64580;简码值低音5,低音6,低音7,1
DW64684,64777,64820,64898;简码值2,3,4,5
DW64968,65030,65058,65110;简码值6,7,高音1,高音
DW65157,65178,65217;简码值高音3,高音4,高音5
;--------------------------------------------------------------------
;第一首《我和你》
;--------------------------------------------------------------------
TABLE10:DB64H,82H,42H,48H
DB54H,64H,18H
DB44H,54H,64H,84H
DB5CH
DB64H,84H,44H,04H,42H
DB54H,64H,28H
DB54H,14H,54H,64H
DB4CH
DB98H,88H
DB98H,48H
DB64H,24H,64H,84H
DB5CH
DB64H,82H,42H,48H
DB54H,64H,28H
DB54H,14H,54H,34H
DB4CH
DB00H
;--------------------------------------------------------------------
;第二首《万水千山总是情》
;--------------------------------------------------------------------
TABLE20: DB64H,74H,84H,04H,82H,94H,84H,6CH
DB54H,44H,04H,62H,54H,44H,2CH
DB24H,18H,44H,54H,64H,84H,94H,64H,5CH
DB64H,74H,84H,04H,82H,94H,84H,6CH
DB54H,44H,04H,62H,54H,44H,2CH
DB24H,18H,44H,64H,54H,04H,42H,24H,44H,4CH
DB64H,84H,9CH,0A4H,94H,74H,84H,04H,92H,8CH,64H,88H
DB64H,84H,9CH,0A4H,0A4H,94H,84H,64H,5CH
DB64H,74H,84H,04H,82H,94H,84H,6CH
DB54H,44H,04H,62H,54H,44H,2CH
DB24H,18H,44H,64H,54H,42H,24,44H,4CH
DB00H
;--------------------------------------------------------------------
;第三首《送别》
;--------------------------------------------------------------------
TABLE30:DB84H,62H,82H,0B8H
DB94H,0B2H,92H,88H
DB84H,42H,52H,64H,52H,44H
DB5CH
DB84H,62H,82H,0B4H,04H,82H
DB94H,0B4H,88H
DB84H,52H,62H,74H,04H,32H
DB4CH
DB94H,0B4H,0B8H
DB0A4H,92H,0A2H,0B8H
DB92H,0A2H,0B2H,92H,92H,82H,62H,42H
DB5CH
DB84H,62H,82H,0B4H,04H,0A2H
DB94H,0B4H,88H
DB84H,52H,62H,74H,04H,32H
DB4CH
DB00H
;--------------------------------------------------------------------
;第四首《北京欢迎您》
;--------------------------------------------------------------------
TABLE40:DB62H,82H,62H,52H,12H
DB62H,52H,12H,64H
DB62H,52H,22H,42H
DB62H,54H
DB52H,42H,22H,42H
DB52H,62H,82H,52H
DB62H,92H,82H,12H
DB52H,44H
DB52H,42H,22H,42H
DB52H,62H,82H,52H
DB62H,92H,82H,82H
DB68H
DB52H,62H,52H,42H
DB82H,92H,64H
DB22H,62H,64H
DB54H,64H
DB64H,84H
DB0B2H,82H,94H
DB02H,92H,82H,62H
DB62H,82H,88H
DB00H
END

㈣ 跪求基于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

㈤ 求51单片机 数字音乐盒 汇编语言代码

Z8279
EQU
8701H
D8279
EQU
8700H
LO
EQU
30H
HI
EQU
31H
ORG
0000H
AJMP
START
ORG
000BH
LJMP
T0_INT
START:
MOV
SP,#60H
MOV
P3,#0FFH
MOV
TMOD,#00000000B
MOV
IE,#10000010B
LCALL
F8279
;;8279的初始化
LCALL
LO_KEY
;;判断是否有下压键
PAN1:
MOV
DPTR,Z8279
MOVX
A,@DPTR
ANL
A,#3FH
MOV
R2,A
;
;保存键值
ANL
A,#01H
;;键值1
JNZ
S_1
JZ
P_1
S_1:
LCALL
SONG_1
P_1:
MOV
A,R2
ANL
A,#02H
;;键值2
JNZ
S_2
JZ
P_2
S_2:
LCALL
SONG_2
P_2
MOV
A,R2
ANL
A,#03H
;;键值3
JNZ
S_3
JZ
P_3
S_3:
LCALL
SONG_3
P_3
MOV
A,R2
ANL
A,#04H
;;键值4
JNZ
S_4
JZ
P_4
S_4
LCALL
SONG_4
P_4
MOV
A,R2
ANL
A,#05H
;;键值5
JNZ
S_5
JZ
PAN1
S_5:
LCALL
SONG_5
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
SONG_1:
;//歌曲1
MOV
R4,#15
LOOP1:
LCALL
VALUE1
SETB
TR0
MOV
R5,#20
LCALL
DELAY
CLR
TR0
MOV
R5,#20
LCALL
DELAY
LCALL
P_KEY
DJNZ
R4,LOOP1
LCALL
SONG_2
RET
SONG_2:
;//歌曲2
MOV
R4,#15
LOOP2:
LCALL
VALUE1
SETB
TR0
MOV
R5,#20
LCALL
DELAY
CLR
TR0
MOV
R5,#20
LCALL
DELAY
LCALL
P_KEY
DJNZ
R4,LOOP2
LCALL
SONG_3
RET
SONG_3:
;//歌曲3
MOV
R4,#15
LOOP3:
LCALL
VALUE1
SETB
TR0
MOV
R5,#20
LCALL
DELAY
CLR
TR0
MOV
R5,#20
LCALL
DELAY
LCALL
P_KEY
DJNZ
R4,LOOP3
LCALL
SONG_4
RET
SONG_4:
;//歌曲4
MOV
R4,#15
LOOP4:
LCALL
VALUE1
SETB
TR0
MOV
R5,#20
LCALL
DELAY
CLR
TR0
MOV
R5,#20
LCALL
DELAY
LCALL
P_KEY
DJNZ
R4,LOOP4
LCALL
SONG_5
RET
SONG_5:
;//歌曲5
MOV
R4,#15
LOOP5:
LCALL
VALUE1
SETB
TR0
MOV
R5,#20
LCALL
DELAY
CLR
TR0
MOV
R5,#20
LCALL
DELAY
LCALL
P_KEY
DJNZ
R4,LOOP5
LCALL
SONG_1
RET
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
VALUE1:
;//歌曲1的频率设置
MOV
DPTR,#FREH1
MOV
A,R4
MOVC
A,@A+DPTR
MOV
HI,A
MOV
DPTR,#FREL1
MOV
A,R4
MOVC
A,@A+DPTR
MOV
LO,A
MOV
R4,#1*****************************************
RET
VALUE2:
;/;/歌曲2的频率设置
MOV
DPTR,#FREH2
MOV
A,R4
MOVC
A,@A+DPTR
MOV
HI,A
MOV
DPTR,#FREL2
MOV
A,R4
MOVC
A,@A+DPTR
MOV
LO,A
MOV
R4,#1
RET
VALUE3:
;//歌曲3的频率设置
MOV
DPTR,#FREH3
MOV
A,R4
MOVC
A,@A+DPTR
MOV
HI,A
MOV
DPTR,#FREL3
MOV
A,R4
MOVC
A,@A+DPTR
MOV
LO,A
MOV
R4,#1
RET
VALUE4:
;//歌曲4的频率设置
MOV
DPTR,#FREH4
MOV
A,R4
MOVC
A,@A+DPTR
MOV
HI,A
MOV
DPTR,#FREL4
MOV
A,R4
MOVC
A,@A+DPTR
MOV
LO,A
MOV
R4,#1
RET
VALUE5:
;//歌曲5的频率设置
MOV
DPTR,#FREH5
MOV
A,R4
MOVC
A,@A+DPTR
MOV
HI,A
MOV
DPTR,#FREL5
MOV
A,R4
MOVC
A,@A+DPTR
MOV
LO,A
MOV
R4,#1
RET
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
T0_INT:
MOV
TL0,LO
MOV
TH0,HI
CPL
P3.4
RETI
DELAY:
MOV
R6,#50
D1:
MOV
R7,#100
DJNZ
R7,$
DJNZ
R6,D1
DJNZ
R5,DELAY
RET
F8279:
MOV
DPTR,Z8279
MOV
A,#10H
MOVX
@DPTR,A
MOV
A,#34H
MOVX
@DPTR,A
MOV
A,#0D1H
MOVX
@DPTR,A
LCALL
DELAY
MOV
A,#80H
MOVX
@DPTR,A
MOV
A,#40H
MOVX
@DPTR,A
RET
LO_KEY:
MOV
DPTR,Z8279
MOVX
A,@DPTR
ANL
A,#0FH
JZ
LO_KEY
RET
P_KEY:
MOV
DPTR,Z8279
MOVX
A,@DPTR
ANL
A,#0FH
JNZ
SIGN1
JZ
SIGN2
SIGN1:
LJMP
PAN1
SIGN2:
RET
FREH1
DB
0,226,229,232,233,236,238,240,241,242,244,244,246,247,248
FREL1
DB
0,4,13,10,20,3,8,6,2,23,5,26,1,4,3
FREH2
DB
0,236,229,232,233,226,230,240,231,246,244,234,236,247,248
FREL2
DB
0,4,13,10,20,3,8,6,2,23,5,26,1,4,3
FREH3
DB
0,226,229,232,233,236,238,240,241,242,244,244,246,247,248
FREL3
DB
0,4,13,10,20,3,8,6,2,23,5,26,1,4,3
FREH4
DB
0,226,229,232,233,236,238,240,241,242,244,244,246,247,248
FREL4
DB
0,4,13,10,20,3,8,6,2,23,5,26,1,4,3
FREH5
DB
0,226,229,232,233,236,238,240,241,242,244,244,246,247,248
FREL5
DB
0,4,13,10,20,3,8,6,2,23,5,26,1,4,3
END

阅读全文

与单片机汇编语言音乐相关的资料

热点内容
打开远程桌面的命令 浏览:836
树莓派如何搭建mqtt服务器 浏览:587
怎么加密w8文件 浏览:609
linuxprogram 浏览:708
php接口编程思想 浏览:92
如何下载电话软件app 浏览:906
java命令行解析 浏览:572
云服务器白嫖 浏览:917
程序员小清新 浏览:989
编译器地址8字节对齐 浏览:464
三菱plc编程win1064 浏览:258
高中英语单词pdf 浏览:425
编译原理词法分析常见问题 浏览:197
车小艺app怎么更新 浏览:77
手机app被管控如何移除 浏览:753
51单片机温湿度检测 浏览:575
安卓抖音显示没网络是怎么回事 浏览:817
2d我的世界源码 浏览:618
怎样制作贴天花板的解压球 浏览:337
服务器如何打开苹果 浏览:97