) ;程序开始 START: ORG 0000H AJMP SET ORG 000BH AJMP AUDIO1 ORG 001BH AJMP POFF ORG 0030H SET: MOV TMOD,#00010010B MOV IE,#10001010B MOV IP,#00000010B MOV SP,#030H MOV R5,#00H MOV R4,#00H MOV A,28H CLR 60H CLR 61H CLR 50H CLR 51H CJNE A,#33H,SET0 SJMP SET2 SET0: CJNE A,#34H,SET1 SJMP SET2 SET1: MOV 20H,#06H MOV 21H,#6DH MOV 22H,#06H MOV 23H,#5DH CLR 7FH SET2: JB P3.7,SET3 MOV 28H,#34H MOV DPTR,#TAB14 ACALL READ SETB TR1 SJMP MAIN SET3: MOV 28H,#33H SET4: SETB TR1 MOV DPTR,#TAB7 ACALL READ ;主程序 MAIN: JNB P3.0,LOOP1 JNB P3.1,LOOP2 JNB P3.2,LOOP3 JNB P3.3,LOOP4 JNB P3.4,LOOP5 MOV R1,#00H MAIN1: JNB P3.5,LOOP6 JNB P3.7,LOOP7 JNB P1.3,LOOP8 JNB P1.4,LOOP9 JNB P1.5,LOOP10 CJNE R5,#01H,MAIN2 AJMP LOOP10 MAIN2: CJNE R5,#02H,MAIN3 AJMP LOOP6 MAIN3: CJNE R5,#03H,MAIN4 AJMP DRILL MAIN4: CJNE R5,#04H,MAIN5 AJMP LOOP11 MAIN5: SJMP MAIN ; LOOP1: AJMP SLOW LOOP2: AJMP QUICK LOOP3: AJMP DOWN LOOP4: AJMP UP LOOP5: AJMP PTT LOOP6: AJMP AUTOCALL LOOP7: MOV A,28H CJNE A,#33H,LOOP71 MOV R4,#05H AJMP DRILL LOOP71: CJNE A,#34H,MAIN MOV R4,#04H AJMP SHORT LOOP8: AJMP DIAN LOOP9: AJMP HUA LOOP10: AJMP HAND LOOP11: AJMP SHORT ;速度增加程序 QUICK: MOV DPTR,#TAB1 MOV A,20H CJNE A,#0FH,QUICK2 MOV DPTR,#TAB11 ACALL READ AJMP MAIN QUICK2: INC 20H ANL 20H,#0FH MOV A,20H MOVC A,@A+DPTR MOV 21H,A QUICK1: MOV DPTR,#TAB5 ACALL READ AJMP MAIN ;速度减少程序 SLOW: MOV DPTR,#TAB1 MOV A,20H CJNE A,#00H,SLOW1 MOV DPTR,#TAB11 ACALL READ AJMP MAIN SLOW1: DEC 20H ANL 20H,#0FH MOV A,20H MOVC A,@A+DPTR MOV 21H,A SJMP QUICK1 ;音调升高程序 UP: MOV DPTR,#TAB2 MOV A,22H CJNE A,#0FH,UP2 MOV DPTR,#TAB11 ACALL READ AJMP MAIN UP2: INC 22H ANL 22H,#0FH MOV A,22H MOVC A,@A+DPTR MOV 23H,A UP1: MOV DPTR,#TAB6 ACALL READ AJMP MAIN ; 音调降低程序 DOWN: MOV DPTR,#TAB2 MOV A,22H CJNE A,#00H,DOWN1 MOV DPTR,#TAB11 ACALL READ AJMP MAIN DOWN1: DEC 22H ANL 22H,#0FH MOV A,22H MOVC A,@A+DPTR MOV 23H,A SJMP UP1 ;数据处理程序 WORD: MOV 25H,A CJNE A,#06H,WORD1 MOV R5,#00H RET WORD1: ANL A,#07H CJNE A,#06H,WORD3 MOV A,25H ANL A,#0F8H RR A RR A RR A MOV R0,A WORD2: ACALL DELAY DJNZ R0,WORD2 SJMP WORD12 WORD3: CJNE A,#00H,WORD4 SJMP WORD5 WORD4: CJNE A,#07H,WORD6 WORD5: MOV R0,#06H SJMP WORD10 WORD6: MOV R0,A WORD10: MOV A,25H WORD7: RL A JNB 0E0H,WORD11 ACALL AUDIO ACALL DELAY4 ACALL AUDIOFF ACALL DELAY SJMP WORD8 WORD11: ACALL AUDIO ACALL DELAY ACALL AUDIOFF ACALL DELAY WORD8: DJNZ R0,WORD7 WORD12: ACALL DELAY4 RET ;音频振荡及PTT输出程序 AUDIO: JNB 7FH,AUDIO3 CLR P1.6 AUDIO3: MOV TL0,23H MOV TH0,23H MOV R3,#03H SETB TR0 CPL P1.7 RET AUDIO1: DJNZ R3,AUDIO2 MOV R3,#03H CPL P1.7 AUDIO2: RE
ti AUDIOFF: MOV R2,#00H CLR TR0 SETB P1.6 SETB P1.7 RET ;自动键"点"控制程序 DIAN: MOV R5,#00H SETB 60H CLR 51H ACALL AUDIO ACALL DELAY ACALL AUDIOFF ACALL DELAY CLR 60H JBC 51H,HUA AJMP MAIN ;自动键"划"控制程序 HUA: MOV R5,#00H SETB 61H CLR 50H ACALL AUDIO ACALL DELAY4 ACALL AUDIOFF ACALL DELAY CLR 61H JBC 50H,DIAN AJMP MAIN ;手动键控制程序 HAND: JB P1.5,HAND2 CJNE R5,#01H,HAND1 AJMP MAIN HAND1: MOV R5,#01H ACALL AUDIO AJMP MAIN HAND2: ACALL DELAY0 ACALL AUDIOFF MOV R5,#00H AJMP MAIN ;自动呼叫程序AUTOCALL: JNB P1.2,AUTCALL3 MOV DPTR,#TAB4 SJMP AUTCALL1AUTCALL3: MOV DPTR,#TAB12AUTCALL1: MOV R5,#02H MOV A,R1 MOVC A,@A+DPTR ACALL WORD INC R1AUTCALL2: AJMP MAIN1 ;混合码听抄练习程序 DRILL: MOV R5,#03H MOV R1,#00H MOV A,24H ADD A,R6 DRILL1: CJNE A,#26H,DRILL4 SJMP DRILL2 DRILL4: JC DRILL5 DRILL2: CLR C SUBB A,#26H SJMP DRILL1 DRILL5: MOV 24H,A MOV DPTR,#TAB3 MOVC A, @A+DPTR ACALL WORD MOV A,20H SUBB A, #03H JC DRILL6 DJNZ R4,DRILL3 MOV R4,#05H DRILL6: ACALL DELAY4 ACALL DELAY DRILL3: AJMP MAIN1 ;短码听抄练习程序 SHORT: MOV R5,#04H MOV R1,#00H MOV A,24H ADD A,R6 SHORT1: CJNE A,#0AH,SHORT4 SJMP SHORT2 SHORT4: JC SHORT5 SHORT2: CLR C SUBB A,#0AH SJMP SHORT1 SHORT5: MOV 24H,A MOV DPTR,#TAB13 MOVC A, @A+DPTR ACALL WORD MOV A,20H SUBB A, #03H JC SHORT6 DJNZ R4,SHORT3 MOV R4,#04H SHORT6: ACALL DELAY4 ACALL DELAY SHORT3: AJMP MAIN1 ;提示音程序 READ: CLR A MOVC A, @A+DPTR MOV R5,#03H ACALL WORD CJNE R5,#03H,READ1 INC DPTR SJMP READ READ1: ACALL DELAY4 ACALL DELAY4 RET ;延时程序1 DELAY0: MOV R1,#0FFH DELAY01: MOV R7,#1FH DELAY02: DJNZ R7,DELAY02 DJNZ R1,DELAY01 RET ;延时程序2 DELAY: MOV R7,21H DELAY1: MOV 26H,#0DH DELAY2: MOV 27H,#0DH DELAY3: DJNZ 27H,DELAY3 DJNZ 26H,DELAY2 JNB P1.3,DELAY6 JNB P1.4,DELAY7 DELAY5: DJNZ R7,DELAY1 RET DELAY4: ACALL DELAY ACALL DELAY ACALL DELAY RET DELAY6: JB 60H,DELAY5 SETB 50H SJMP DELAY5 DELAY7: JB 61H,DELAY5 SETB 51H SJMP DELAY5 ;置PTT程序 PTT: CPL 7FH JNB 7FH,PTT2 MOV DPTR,#TAB8 PTT1: ACALL READ AJMP MAIN PTT2: MOV DPTR,#TAB9 SJMP PTT1 ;自动关机程序 POFF: DJNZ R6,POFF1 MOV R6,#26H INC R2 CJNE R2,#2FH,POFF1 SJMP POFF2 POFF1: MOV TL1,#0FH MOV TH1,#00H RETI POFF2: MOV DPTR,#TAB10 ACALL READ MOV 87H,#02H ;速度(延时)数据表 TAB1: DB 0FFH,0C0H,0A7H,91H,7EH,6DH,5EH,53H DB 49H,45H,3CH,34H,2DH,28H,23H,20H, ;音调数据表 TAB2: DB 36H,3DH,40H,46H,4CH,53H,5DH,63H DB 6CH,76H,81H,8DH,9AH,0A8H,0B8H,0C9H ;混合码听抄字符数据表 TAB3: DB 42H,84H,0A4H,83H,01H,24H,0C3H,04H DB 02H,74H,0A3H,44H,0C2H,82H,0E3H,64H DB 0D4H,43H,03H,81H,23H,14H,63H,94H DB 0B4H,0C4H,0FDH,7DH,3DH,1DH,0DH,05H DB 85H,0C5H,0E5H,0F5H,95H,30H ;自动呼叫数据表 TAB4: DB 0A4H,0D4H,26H,0A4H,0D4H,26H ; CQ CQ DB 0A4H,0D4H,26H,83H,01H,26H ; CQ DE DB 84H,83H,0DH,02H,84H,04H,26H ;BD4IBH DB 84H,83H,0DH,02H,84H,04H,26H ;BD4IBH DB 84H,83H,0DH,02H,84H,04H,26H ;BD4IBH DB 64H,03H,01H,26H,0A3H,06H ; PSE K ;提示音"V"数据表 TAB5: DB 14H,06H ;提示音"B"数据表 TAB6: DB 84H,06H ;提示音"OK"数据表 TAB7: DB 0E3H,0A3H,06H ;提示音"ON"数据表 TAB8: DB 0E3H,82H,06H ;提示音"OFF"数据表 TAB9: DB 0E3H,24H,24H,06H ;提示音"END"数据表 TAB10: DB 01H,82H,83H,06H ;提示音:"E"数据表 TAB11: DB 01H,06H ;P1.2为零时自动呼叫数据表 TAB12: DB 0A4H,0D4H,26H,0A4H,0D4H,26H DB 0A4H,0D4H,26H,83H,01H,26H DB 84H,42H,0DH,02H,84H,04H,26H ;BA4IBH DB 84H,42H,0DH,02H,84H,04H,26H DB 84H,42H,0DH,02H,84H,04H,26H DB 64H,03H,01H,26H,0A3H,06H ;短码听抄字符数据表 TAB13: DB 81H,42H,23H,14H,0DH,05H,85H DB 84H,83H,82H ;提示音:"S"数据表 TAB14: DB 03H,06H END
0