(2000h)=12h,(2001h)=46h,(2002h)=00h,(2003h)=7bh,(2004h)=00h,(2005h)=10h
绝对正确,看看我得唱歌程序就知道了
;T0中断次数计数寄存器20H;音调长度寄存器30H;音调寄存器31H
SPEAKER BIT P2.0
ORG 0000H
LJMP START
ORG 000BH
INC 20H
MOV TH0,#0D8H
MOV TL0,#0EFH
RETI
ORG 0030H
START:
MOV SP,#60H
MOV TMOD,#01H
MOV TH0,#0D8H
MOV TL0,#0EFH
MOV IE,#82H
MAIN:
LCALL START_MUSIC
LJMP $
START_MUSIC:
CLR A
MOV 20H,#00H
MOV DPTR,#DAT_TYGK
MOVC A,@A+DPTR
MOV 31H,A
CLR A
INC DPTR
MOVC A,@A+DPTR
MOV 30H,A
MUSIC:
SETB TR0
MUSI:
CPL SPEAKER
LCALL DELAY
MOV A,30H
CJNE A,20H,MUSI
CLR TR0
NEXT_YD: ;修改音调,音调长度等。。。
MOV 20H,#00H
INC DPTR
CLR A
MOVC A,@A+DPTR
JZ OVER
CJNE A,#0FFH,LP
INC DPTR
CLR A
MOVC A,@A+DPTR
MOV 32H,A ;休止时间寄存器32H
LJMP WEIT
LP:
MOV 31H,A
INC DPTR
CLR A
MOVC A,@A+DPTR
MOV 30H,A
LJMP MUSIC
OVER:
SETB SPEAKER
CLR TR0
MOV 20H,#00H
CLR A
RET
WEIT:
SETB TR0
MOV A,32H
CJNE A,20H,$
CLR TR0
CLR A
LJMP NEXT_YD
DELAY:
NOP
MOV R7,31H
DL:
MOV R6,#03H
DJNZ R6,$
DJNZ R7,DL
RET
DAT_TZDN: ;同桌的你
DW 3920H,0FF02H,3920H,0FF02H,3920H,0FF02H,3920H,4420H
DW 4020H,3960H,2D60H,3320H,0FF02H,3320H,0FF02H,3320H
DW 0FF02H,3320H,4020H,3320H,39C0H,0FF02H,3920H,0FF02H
DW 3920H,0FF02H,3920H,0FF02H,3920H,2D20H,3320H,3940H
DW 4040H,0FF02H,4040H,0FF02H,4020H,0FF02H,4020H,0FF02H
DW 4020H,0FF02H,4020H,4420H,4C20H,56C0H,2B20H,0FF02H
DW 2B20H,0FF02H,2B20H,0FF02H,2B20H,3920H,3320H,2B40H
DW 0FF02H,2B20H,2260H,2620H,0FF02H,2620H,0FF02H,2620H
DW 0FF02H,2620H,2B20H,2D20H,33C0H,2D20H,0FF02H,2D20H
DW 0FF02H,2D20H,0FF02H,2D20H,2D20H,2B20H,2660H,3960H
DW 2D20H,0FF02H,2D20H,2B20H,2620H,2B20H,2D20H,2BC0H
DW 2B40H,0FF02H,2B20H,0FF02H,2B20H,3920H,3320H,2B60H
DW 2260H,2640H,0FF02H,2620H,0FF02H,2620H,2B20H,2D20H
DW 33C0H,2D40H,0FF02H,2D20H,0FF02H,2D20H,0FF02H,2D20H
DW 2B20H,2660H,3960H,2D20H,0FF02H,2D20H,2B20H,2620H
DW 2B20H,2D20H,2BC0H
DB 00H
DAT_WSQSZSQ: ;万水千山总是情
DW 4436H,4036H,3951H,0FF02H,391BH,3336H,3936H,44A2H
DW 4C36H,5651H,441BH,4C36H,5636H,66A2H,0FF02H,6636H
DW 726CH,5636H,4C36H,4436H,3936H,3336H,4436H,4CA2H
DW 4436H,4036H,3951H,0FF02H,391BH,3336H,3936H,44A2H
DW 4C36H,5651H,441BH,4C36H,5636H,66A2H,0FF02H,6636H
DW 726CH,5651H,441BH,4C6CH,5636H,6636H,56A2H,4436H
DW 3936H,33A2H,2B36H,3336H,4036H,3936H,3336H,4436H
DW 396CH,4436H,396CH,4436H,3936H,33A2H,2B36H,0FF02H
DW 2B36H,3336H,3936H,4436H,4CA2H,4436H,4036H,3951H
DW 0FF02H,391BH,3336H,3936H,44A2H,4C36H,5651H,441BH
DW 4C36H,5636H,66A2H,0FF02H,6636H,726CH,5636H,4436H
DW 4C51H,561BH,6636H,5636H,0FF02H,56A2H,6636H,726CH
DW 5636H,4436H,4C51H,561BH,6636H,5636H,0FF02H,56A2H
DB 00H
DAT_XSFYZ: ;相思风雨中
DW 6640H,4420H,4C20H,4440H,6640H,4C30H,0FF02H,4C10H
DW 4020H,5B20H,6680H,0FF02H,6640H,3320H,3920H,3340H
DW 4C40H,4430H,4C10H,4020H,4C20H,4480H,2B40H,2D20H
DW 3320H,2D40H,4440H,3320H,0FF02H,3320H,3920H,4020H
DW 3940H,5640H,4C30H,0FF02H,4C10H,0FF02H,4C20H,0FF02H
DW 4C20H,0FF02H,4C20H,0FF02H,4C20H,5B20H,4C20H,44E0H
DW 6640H,4420H,4C20H,4440H,6640H,4C30H,0FF02H,4C10H
DW 4020H,5B20H,6680H,0FF02H,6640H,0FF02H,6620H,7220H
DW 3340H,4C40H,4430H,4C10H,4020H,4C20H,4480H,2B40H
DW 2D20H,3320H,2D40H,4440H,0FF02H,4420H,0FF02H,4420H
DW 3320H,4420H,0FF02H,4440H,4C40H,5B60H,0FF02H,5B20H
DW 0FF02H,5B20H,0FF02H,5B20H,4C20H,5620H,66C0H,2B20H
DW 2D20H,2B40H,3320H,2D20H,0FF02H,2D20H,3320H
DW 3920H,33C0H,3920H,4020H,3940H,4420H,4020H
DW 0FF02H,4020H,4420H,4C20H,44C0H,2B20H,2D20H,2B60H
DW 3320H,2D20H,0FF02H,2D20H,3320H,2D20H,2B30H,2D10H
DW 3320H,3920H,4440H,6620H,5620H,4C60H,0FF02H,4C20H
DW 0FF02H,4C20H,0FF02H,4C20H,3920H,4020H,44E0H,6640H
DW 4420H,4C20H,4440H,6640H,4C30H,0FF02H,4C10H,5620H
DW 5B20H,3380H,0FF02H,6640H,3320H,3920H,3340H,4C40H
DW 4420H,4C20H,5620H,4C20H,4480H,2B40H,2D20H,3320H
DW 2D40H,4440H,0FF02H,4420H,0FF02H,4420H,3320H,4420H
DW 0FF02H,4440H,4C40H,5B40H,0FF02H,5B20H,0FF02H,5B20H
DW 0FF02H,5B20H,0FF02H,5B20H,4C20H,5620H,66E0H,3320H
DW 2D20H,2B40H,2D20H,3320H,2D40H,4440H,0FF02H,4420H
DW 0FF02H,4420H,3320H,4420H,0FF02H,4440H,4C40H,5B60H
DW 0FF02H,5B20H,0FF02H,5B20H,0FF02H,5B20H,4C20H,5620H,66E0H
DB 00H
DAT_YLDBWDX: ;月亮代表我的心
DW 7220H,5660H,4420H,3960H,5620H,5B60H,4420H,3960H
DW 0FF02H,3920H,3360H,2D20H,2B60H,3320H,39A0H,4420H
DW 4C20H,5660H,0FF02H,5620H,0FF02H,5640H,4420H,4C20H
DW 5660H,0FF02H,5620H,0FF02H,5640H,4C20H,4420H,4C60H
DW 5620H,6640H,4440H,4CC0H
DW 7220H,5660H,4420H,3960H,5620H,5B60H,4420H,3960H
DW 0FF02H,3920H,3360H,2D20H,2B60H,3320H,39A0H,4420H
DW 4C20H,5660H,0FF02H,5620H,0FF02H,5640H,4420H,4C20H
DW 5660H,0FF02H,5620H,0FF02H,5640H,4C20H,4420H,4C60H
DW 6620H,5B40H,4C40H,56C0H,4420H,3920H,4460H,4C20H
DW 5640H,3940H,5BC0H,6620H,5B20H,5660H,0FF02H,5620H
DW 0FF02H,5640H,4C20H,4420H,4CC0H,7220H,5660H,4420H
DW 3960H,5620H,5B60H,4420H,3960H,0FF02H,3920H,3360H
DW 2D20H,2B60H,3340H,39A0H,4420H,4C20H,5660H,0FF02H
DW 5620H,0FF02H,5640H,4420H,4C20H,5660H,0FF02H,5620H
DW 0FF02H,5640H,4C20H,4420H,4C60H,6620H,5B40H,4C40H
DW 56C0H,4420H,4C20H,5660H,0FF02H,5620H,0FF02H,5640H
DW 4420H,4C20H,5660H,0FF02H,5620H,0FF02H,5640H,4C20H
DW 4420H,4C60H,6620H,5B40H,4C40H,56C0H
DB 00H
DAT_TYGK:
DW 3320H,0FF02H,3320H,2220H,0FF02H,2220H,2B20H,2D20H
DW 3340H,3920H,4410H,3910H,3320H,0FF02H,3320H,4480H,0FF02H
DW 4420H,3320H,0FF02H,3320H,4420H,0FF02H,4420H,2D20H
DW 0FF02H,2D20H,4420H,0FF02H,4420H,2B20H,0FF02H,2B20H
DW 0FF02H,2B20H,2D80H
DW 3320H,2620H,0FF02H,2620H,3320H,0FF02H,3320H,2020H,0FF02H
DW 2020H,2620H,2220H,0FF02H,2220H,2020H,0FF02H,2020H,2280H
DW 2B20H,0FF02H,2B20H,0FF02H,2B20H,2D20H,0FF02H,2B20H
DW 2220H,0FF02H,2220H,2B20H,2D20H,3320H,2B20H,2D40H,2B20H
DW 2D20H,3340H,4020H,4420H,3320H,2D20H,2B20H,0FF02H
DW 2220H,2B20H,0FF02H,2B40H,2D10H,2B10H,2D20H,33C0H
DW 4020H,0FF02H,4020H,0FF02H,4020H,0FF02H,4020H,3320H
DW 3920H,4020H,4420H,4C20H,4020H,3320H,4480H,3320H,0FF02H
DW 3320H,0FF02H,3340H,0FF02H,2D20H,3320H,2D20H,2B10H,2210H
DW 2610H,2B10H,2220H,2020H,2280H,2030H,2210H,2020H,1920H
DW 2010H,2210H,2620H,0FF02H,2640H,2220H,2B20H,3320H,2B20H
DW 2D80H,2B30H,2D10H,2B20H,2220H,2B10H,2D10H,3320H,0FF02H
DW 3340H,2D20H,3320H,4020H,3320H,4440H,0FF02H,4440H,3360H
DW 2D20H,2B40H,2240H,2020H,2220H,2B20H,2D10H,2B10H,2240H
DW 0FF02H,2240H,2B60H,2220H,2D80H,33F0H
DB 00H
END
不信可以试验
追问和楼下的答案不一样,这也就是俩本书的不同的地方
追答放心,我得绝对正确,把我得程序烧进芯片或者仿真就知道了