"); //-->
; 合弦音乐 AT89C2051
;2006年2月16日,北院单片机办公室
ORG 00H
AJMP START
ORG 000BH
AJMP TIM0
ORG 001BH
AJMP TIM1
ORG 0030H
START: MOV TMOD,#00010001B
MOV IE,#10101010B
MOV DPTR,#TAB2
MOV 30H,DPL
MOV 31H,DPH
START1: MOV DPL,30H
MOV DPH,31H
MOV A,#00H
MOVC A,@A+DPTR
MOV R0,A
MOV A,#00H
INC DPTR
MOVC A,@A+DPTR
MOV R1,A
INC DPTR
MOV 30H,DPL
MOV 31H,DPH
JZ STOP
MOV A,R0
JNZ SING
CLR TR0
CLR TR1
SETB P1.1
SETB P1.0
LOOP1: ACALL DELY
DJNZ R1,LOOP1
AJMP START1
SING: MOV DPTR,#TAB1
DEC R0
MOV A,R0
MOV B,#04H
MUL AB
MOV R0,A
MOVC A,@A+DPTR
MOV 21H,A
INC DPTR
MOV A,R0
MOVC A,@A+DPTR
MOV 20H,A
INC DPTR
MOV 20H,A
INC DPTR
MOV A,R0
MOVC A,@A+DPTR
MOV 23H,A
INC DPTR
MOV A,R0
MOVC A,@A+DPTR
MOV 22H,A
MOV TL0,20H
MOV TH0,21H
MOV TL1,22H
MOV TH1,23H
SETB TR0
SETB TR1
LOOP2: ACALL DELY
DJNZ R1,LOOP2
AJMP START1
STOP: CLR TR0
CLR TR1
SETB P1.1
SETB P1.0
LJMP START
;MOV 87H,#02H
TIM0: MOV TL0,20H
MOV TH0,21H
CPL P1.1
RETI
TIM1: MOV TL1,22H
MOV TH1,23H
CPL P1.0
RETI
DELY: MOV R2,#70
DELY1: MOV R3,#255
DJNZ R3,$
DJNZ R2,DELY1
RET
TAB1:
DW 63628,64021,63835,64185
DW 64021,64331,64103,64400
DW 64260,64524,64400,64632
DW 64524,64732,64580,64777
DW 64684,64860,64777,64934
DW 64820,64968,64898,65030
DW 64968,65085,65030,65134
DW 65058,65157,65110,65198
DW 65157,65235,65178,65252
DW 65217,65283,65252,65310
DW 65283,65335
TAB2:
DW 0608H 0808H 0908H 0A18H 0C08H 0A08H
DW 0808H 0910H 0620H 0008H 0808H 0908H
DW 0A08H 0C18H 0001H 0C08H 0D10H 0910H
DW 0A30H 0001H 0A08H 0C08H 0D20H 0C18H
DW 0D08H 0F08H 0E04H 0D04H 0C08H 0D08H
DW 0A10H 0004H 0808H 0908H 0A18H 0C08H
DW 0810H 0610H 0808H 0908H 0A08H 0D08H
DW 0C30H 0010H 0A20H 0D18H 0001H 0D08H
DW 0C08H 0B08H 0A10H 0001H 0920H 0A18H
DW 0C08H 0608H 0808H 0910H 0010H 0808H
DW 0908H 0A10H 0C0BH 0001H 0C04H 0D10H
DW 0F10H 0E08H 0D08H 0C08H 0A08H 0D40H
DW 0040H 0000H
END
*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。