Dear bosses, can help to find the program error
/* SB1 sounds SB2 2 1 3 sounds SB4 4 SB3 SB1SB2 5 SB2SB3 6 note SB3SB4 7 SB1SB4 I note SB1SB3 first song SB2SB4 second song */
ORG 0000 h
LJMP KEYP0
KEYP0: MOV R0, # 00 h
The CLR TR0
SETB P2.4; Close the buzzer
SETB P2.3; Close the digital tube
WU: MOV R0, P3. Scanning the keyboard
CJNE R0, # 0 FFH KEYPO1; Any other input
JMP WU
KEYPO1: CJNE R0, # 0 FBH, KEYPO2; Enter 1, and the 1 jump
SETB P2.4; Buzzer at high level
MOV R3, # 200
MAIN01: MOV TMOD, # 01 h; Initialization, works 1
MOV TL0, # 21 h; Write count initial
MOV TH0, # 0 f9h
SETB TR0; Start the count
WAIT1: JNB TF0, WAIT1
The CLR TF0
CPL P2.4; The buzzer rang
The CLR P2.3; Digital tube display 1
MOV A, # 11111001 b
MOV P0, A
DJNZ R3, MAIN01
LJMP KEYP0; Return procedure KEYP0
KEYPO2: CJNE R0, # 0 f7h, KEYPO3; Type 2, and the 2 jump
SETB P2.4; Buzzer at high level
MOV R3, # 200
MAIN02: MOV TMOD, # 01 h
MOV TL0 e1h # 0; Write count initial
MOV TH0, # 0 f9h
SETB TR0
WAIT2: JNB TF0, WAIT2
The CLR TF0
CPL P2.4; The buzzer rang
The CLR P2.3; Digital tube display 2
MOV A, # 10100100 b
MOV P0, A
DJNZ R3, MAIN02
LJMP KEYP0
KEYPO3: CJNE R0, # 0 efh, KEYPO4; Type 3, and the 3 jump
SETB P2.4; Buzzer at high level
MOV R3, # 200
MAIN03: MOV TMOD, # 01 h
MOV TL0, # 8 ch
MOV TH0, # 0 fah
SETB TR0
WAIT3: JNB TF0, WAIT3
The CLR TF0
CPL P2.4
The CLR P2.3
MOV A, # 10110000 b
MOV P0, A
DJNZ R3, MAIN03
LJMP KEYP0
KEYPO4:
CJNE R0, # 0 DFH, KEYPO5; Enter 4, and the 4 jump
SETB P2.4
MOV R3, # 200
MAIN04: MOV TMOD, # 01 h
MOV TL0, # 0 d8h
MOV TH0, # 0 fah
SETB TR0
WAIT4: JNB TF0, WAIT4
The CLR TF0
CPL P2.4
The CLR P2.3
MOV A, # 10011001 b
MOV P0, A
DJNZ R3, MAIN04
LJMP KEYP0
KEYPO5: CJNE R0, # 0 f3h, KEYPO6; Input 5, and the 5 jump
SETB P2.4
MOV R3, # 200
MAIN05: MOV TMOD, # 01 h
MOV TL0, # 068 h
MOV TH0, # 0 FBH
SETB TR0
WAIT5: JNB TF0, WAIT5
The CLR TF0
CPL P2.4
The CLR P2.3
MOV A, # 10010010 b
MOV P0, A
DJNZ R3, MAIN05
LJMP KEYP0
KEYPO6: CJNE R0, # 0 e7h, KEYPO7; Enter 6, and the six jump
SETB P2.4
MOV R3, # 200
MAIN06: MOV TMOD, # 01 h
MOV TL0, # 0 e9h
MOV TH0, # 0 FBH
SETB TR0
WAIT6: JNB TF0, WAIT6
The CLR TF0
CPL P2.4
The CLR P2.3
MOV A, # 10000010 b
MOV P0, A
DJNZ R3, MAIN06
LJMP KEYP0
KEYPO7: CJNE R0, # 0 CFH, KEYPO8; Input 7, and the 7 jump
SETB P2.4
MOV R3, # 200
MAIN07: MOV TMOD, # 01 h
MOV TL0, # 5 bh
MOV TH0, # 0 FCH
SETB TR0
WAIT7: JNB TF0, WAIT7
The CLR TF0
CPL P2.4
The CLR P2.3
MOV A, # 11111000 b
MOV P0, A
DJNZ R3, MAIN07
LJMP KEYP0
KEYPO8: CJNE R0, # 0 DBH, KEYPO9; Type I, and not I jump
SETB P2.4
MOV R3, # 200
MAIN08: MOV TMOD, # 01 h
MOV TL0, # 8 fh
MOV TH0, # 0 FCH
SETB TR0
WAIT8: JNB TF0, WAIT8
The CLR TF0
CPL P2.4
The CLR P2.3
MOV A, # 10000000 b
MOV P0, A
DJNZ R3, MAIN08
LJMP KEYP0
KEYPO9: CJNE R0, # 0 ebh, KEYPO10; Jump to the first song program
LJMP MUSTART1
KEYPO10: CJNE R0, # 0 d7h, JIELI; Jump to the next song program
LJMP MUSTART2
JIELI: JMP KEYP0; Return to the main program
MUSTART1:; Song 1 broadcast program
MOV R0, # 00 h; The beat table pointer zero
MOV R1, # 00 h; Note table pointer zero
RTAB: A, MOV R0
MOV DPTR, # RYTH
MOVC A, @ A + DPTR; Look-up table method to remove a tempo data put in R2 counter
MOV R2, A
TTAB: MOV A, R1
MOV DPTR, # TONE
MOVC A, @ A + DPTR
MOV R3, A; Take out the notes high table eight
INC R1. Pointer to add 1
MOV A, R1
MOV DPTR, # TONE
MOVC A, @ A + DPTR
MOV R4, A; Remove the lower 8-bit
SETB P2.4; Tones of the square wave output corresponding
LOOP: MOV R5, # 3 bh
MAIN: MOV TMOD, # 01 h
MOV TL0, R4
MOV TH0, R3
SETB TR0
WAIT WAIT: JNB TF0,
The CLR TF0
CPL P2.4
MAYA: JB P3.2, MAYB; Whether P3.2 mouth for 1
JB P3.4, MAYB; Whether P3.4 mouth for 1
LJMP RA; P3.4 mouth to 0 then jump to program RA
MAYB: JB P3.3, JIELI; Whether P3.3 mouth for 1
JB P3.5, JIELI; Whether P3.5 mouth for 1
LJMP MUSTART2; P3.5 mouth to 0 put second song
RA: DJNZ R5, MAIN; No interrupt continued to put the first song
DJNZ R2, LOOP
INC R0; Two table pointer is added 1
INC R1
CJNE R1, # 88, RTAB; Determine whether to take the
LJMP KEYP0
TONE:
DB 0 FBH, 68 h, 0 FDH, eh, 6 0 FDH, 45 h, 0 FCH, 0 efh, 0 FCH, 8 fh, 0 FCH, 8 fh, 0 FCH, 8 fh, 0 FCH, 8 fh 5 bh, 0 FCH,
DB FCH, 0 0 efh, 0 FDH, 45 h, 0 FBH, 68 h, 0 FBH, 68 h, 0 FCH, 8 fh, 0 FCH, 5 bh, 0 FBH, 0 e9h, 0 FBH, 68 h, 0 FBH, 68 h
DB fah 0, 0 DBH, 0 fah, 8 ch, 0 f9h, 21 h, 0 fah, 8 ch, 0 fah, 0 d8h, 0 FBH, 68 h, 0 FBH, 68 h, 0 FBH, 68 h, 0 FBH, 68 h
FBH FBH DB 0, 0 e9h, 0, 0 e9h, 0 FBH, 68 h, 0 FBH, 0 e9h, 0 FCH, 5 bh, 0 fah, 8 ch, 0 FCH, 8 fh, 0 FCH, 8 fh, 0 FCH, 5 bh
DB 0 FCH, 8 fh, 0 FCH, 0 efh, 0 FCH, 0 efh, 0 FCH, 0 efh, 0 FCH, 8 fh, 0 FDH, 45 h, 0 FDH, eh, 6 0 FCH, 0 efh
RYTH:
The DB 04,04,04,04,04,04,04,04,04,04
The DB 04,05,04,04,04,04,04,04,04,04
The DB 04,04,04,06,04,04,04,07,04,04
The DB 04,04,04,06,04,04,04,07,04,04
The DB 04,04,04,04
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull