基于51单片机的源代码JIN1 EQU P1.0JIN2 EQU P1.1JIN3 EQU P1.2JIN4 EQU P1.3INH EQU P2.3CP EQU P2.2ORG 0000HAJMP MAINORG 0100HMAIN: MOV SP,#70HMOV TMOD,#20H ;自动重装MOV SCON,#50HMOV PCON,#80H ;双倍波特率SMOD=1 MOV TH1,#0FFH ;57600MHZ波特率初值MOV TL1,#0FFHMOV P1,#00HMOV P2,#00HSETB TR1SETB P2.1LOOP: LCALL keepLCALL SHUCHUACALL QINGLINGAJMP LOOP QINGLING: CJNE R0,#17,QINGLING1MOV R0,#00H QINGLING1: CJNE R1,#9,FANHUIMOV R1,#00HFANHUI: RETSHUCHU: ACALL SHUAACALL SHUBACALL SHUCACALL SHUDSHUA: MOV R3,#4SETB JIN1LLS: MOV R2,#8LJMP keepINC R1SETB INHCLR JIN1CLR INHLLS1: LJMP keepSETB CPCLR CPDJNZ R2,LLS1DJNZ R3,LLSRET SHUB: MOV R3,#4SETB JIN2 QQS: MOV R2,#8LJMP keepINC R1SETB INHCLR JIN2CLR INH QQS1: LJMP keepSETB CPINC R0CLR CPDJNZ R2,QQS1DJNZ R3,QQSRET SHUC: MOV R3,#4SETB JIN3 JJS: MOV R2,#8LJMP keepINC R1SETB INHCLR JIN3CLR INH JJS1: LJMP keepSETB CPINC R0CLR CPDJNZ R2,JJS1DJNZ R3,JJSRET SHUD: MOV R3,#4SETB JIN4 KKS: MOV R2,#8LJMP keepINC R1SETB INHCLR JIN4CLR INH KKS1: LJMP keepINC R0CLR CPDJNZ R2,KKS1DJNZ R3,KKSRETkeep: JB P2.1,KEEOCLR P2.1CJNE R1,#1,PAN1MOV R1,#00HLJMP KEEP1KEEO: RETPAN1: CJNE R1,#2,PAN2LJMP KEEP2PAN2: CJNE R1,#3,PAN3LJMP KEEP3PAN3: CJNE R1,#4,PAN4LJMP KEEP4PAN4: CJNE R1,#5,PAN5LJMP KEEP5PAN5: CJNE R1,#6,PAN6LJMP KEEP6PAN6: CJNE R1,#7,PAN7LJMP KEEP7PAN7: CJNE R1,#8,PAN8LJMP KEEP8PAN8: CJNE R1,#9,PAN9LJMP KEEP9PAN9: CJNE R1,#10,PAN10LJMP KEEP10 PAN10: CJNE R1,#11,PAN11LJMP KEEP11 PAN11: CJNE R1,#12,PAN12LJMP KEEP12 PAN12: CJNE R1,#13,PAN13LJMP KEEP13 PAN13: CJNE R1,#14,PAN14LJMP KEEP14 PAN14: CJNE R1,#15,PAN15LJMP KEEP15 PAN15: CJNE R1,#16,KEEOLJMP KEEP16KEEP1: CJNE R0,#1,LL1MOV R0,#00HLJMP SONGCHU LL1: CJNE R0,#2,LL2MOV R0,#00HMOV A,#02HLJMP SONGCHU LL2: CJNE R0,#3,LL3MOV R0,#00HMOV A,#03HLJMP SONGCHU LL3: CJNE R0,#4,LL4MOV R0,#00HMOV A,#04HLJMP SONGCHU LL4: CJNE R0,#5,LL5MOV R0,#00HMOV A,#05HLJMP SONGCHU LL5: CJNE R0,#6,LL6MOV R0,#00HMOV A,#06HLJMP SONGCHU LL6: CJNE R0,#7,LL7MOV R0,#00HMOV A,#07HLJMP SONGCHU LL7: CJNE R0,#8,LL8MOV R0,#00HMOV A,#08HLJMP SONGCHULL8: RETKEEP2: CJNE R0,#1,LL9MOV R0,#00HMOV A,#9LJMP SONGCHU LL9: CJNE R0,#2,LL10MOV R0,#00HMOV A,#10LJMP SONGCHU LL10: CJNE R0,#3,LL11MOV R0,#00HMOV A,#11LJMP SONGCHU LL11: CJNE R0,#4,LL12MOV A,#12LJMP SONGCHU LL12: CJNE R0,#5,LL13MOV R0,#00HMOV A,#13LJMP SONGCHU LL13: CJNE R0,#6,LL14MOV R0,#00HMOV A,#14LJMP SONGCHU LL14: CJNE R0,#7,LL15MOV R0,#00HMOV A,#15LJMP SONGCHU LL15: CJNE R0,#8,LL16MOV R0,#00HMOV A,#16LJMP SONGCHULL16: RETKEEP3: CJNE R0,#1,LL17MOV R0,#00HMOV A,#17LJMP SONGCHU LL17: CJNE R0,#2,LL18MOV R0,#00HMOV A,#18LJMP SONGCHU LL18: CJNE R0,#3,LL19MOV R0,#00HMOV A,#19LJMP SONGCHU LL19: CJNE R0,#4,LL20MOV R0,#00HMOV A,#20LJMP SONGCHU LL20: CJNE R0,#5,LL21MOV R0,#00HMOV A,#21LJMP SONGCHU LL21: CJNE R0,#6,LL22MOV R0,#00HMOV A,#22LJMP SONGCHULL22: CJNE R0,#7,LL23MOV R0,#00HMOV A,#23LJMP SONGCHU LL23: CJNE R0,#8,LL24MOV R0,#00HMOV A,#24LJMP SONGCHULL24: RETKEEP4: CJNE R0,#1,LL25MOV R0,#00HMOV A,#25LJMP SONGCHU LL25: CJNE R0,#2,LL26MOV R0,#00HMOV A,#26LJMP SONGCHU LL26: CJNE R0,#3,LL27MOV R0,#00HMOV A,#27LJMP SONGCHU LL27: CJNE R0,#4,LL28MOV R0,#00HMOV A,#28LJMP SONGCHU LL28: CJNE R0,#5,LL29MOV R0,#00HMOV A,#29LJMP SONGCHU LL29: CJNE R0,#6,LL30MOV R0,#00HMOV A,#30LJMP SONGCHU LL30: CJNE R0,#7,LL31MOV R0,#00HMOV A,#31LJMP SONGCHU LL31: CJNE R0,#8,LL32MOV R0,#00HMOV A,#32LJMP SONGCHULL32: RETKEEP5: CJNE R0,#1,KK1MOV R0,#00HLJMP SONGCHU KK1: CJNE R0,#2,KK2MOV R0,#00HMOV A,#34LJMP SONGCHU KK2: CJNE R0,#3,KK3MOV R0,#00HMOV A,#35LJMP SONGCHU KK3: CJNE R0,#4,KK4MOV R0,#00HMOV A,#36LJMP SONGCHU KK4: CJNE R0,#5,KK5MOV R0,#00HMOV A,#37LJMP SONGCHU KK5: CJNE R0,#6,KK6MOV R0,#00HMOV A,#38LJMP SONGCHU KK6: CJNE R0,#7,KK7MOV R0,#00HMOV A,#39LJMP SONGCHU KK7: CJNE R0,#8,KK8MOV R0,#00HMOV A,#40LJMP SONGCHUKK8: RETKEEP6: CJNE R0,#1,KK9MOV R0,#00HMOV A,#41LJMP SONGCHU KK9: CJNE R0,#2,KK10MOV R0,#00HMOV A,#42LJMP SONGCHU KK10: CJNE R0,#3,KK11MOV R0,#00HMOV A,#43LJMP SONGCHU KK11: CJNE R0,#4,KK12MOV A,#44LJMP SONGCHU KK12: CJNE R0,#5,KK13MOV R0,#00HMOV A,#45LJMP SONGCHU KK13: CJNE R0,#6,KK14MOV R0,#00HMOV A,#46LJMP SONGCHU KK14: CJNE R0,#7,KK15MOV R0,#00HMOV A,#47LJMP SONGCHU KK15: CJNE R0,#8,KK16MOV R0,#00HMOV A,#48LJMP SONGCHUKK16: RETKEEP7: CJNE R0,#1,KK17MOV R0,#00HMOV A,#49LJMP SONGCHU KK17: CJNE R0,#2,KK18MOV R0,#00HMOV A,#50LJMP SONGCHU KK18: CJNE R0,#3,KK19MOV R0,#00HMOV A,#51LJMP SONGCHU KK19: CJNE R0,#4,KK20MOV R0,#00HMOV A,#52LJMP SONGCHU KK20: CJNE R0,#5,KK21MOV R0,#00HMOV A,#53LJMP SONGCHU KK21: CJNE R0,#6,KK22MOV R0,#00HMOV A,#54LJMP SONGCHUKK22: CJNE R0,#7,KK23MOV R0,#00HMOV A,#55LJMP SONGCHU KK23: CJNE R0,#8,KK24MOV R0,#00HMOV A,#56LJMP SONGCHUKK24: RETKEEP8: CJNE R0,#1,KK25MOV R0,#00HMOV A,#57LJMP SONGCHU KK25: CJNE R0,#2,KK26MOV R0,#00HMOV A,#58LJMP SONGCHU KK26: CJNE R0,#3,KK27MOV R0,#00HMOV A,#59LJMP SONGCHU KK27: CJNE R0,#4,KK28MOV R0,#00HMOV A,#60LJMP SONGCHU KK28: CJNE R0,#5,KK29MOV R0,#00HMOV A,#61LJMP SONGCHU KK29: CJNE R0,#6,KK30MOV R0,#00HMOV A,#62LJMP SONGCHU KK30: CJNE R0,#7,KK31MOV R0,#00HMOV A,#63LJMP SONGCHU KK31: CJNE R0,#8,KK32MOV R0,#00HMOV A,#64LJMP SONGCHUKK32: RETKEEP9: CJNE R0,#1,JJ1MOV R0,#00HMOV A,#65LJMP SONGCHU JJ1: CJNE R0,#2,JJ2MOV R0,#00HMOV A,#66LJMP SONGCHU JJ2: CJNE R0,#3,JJ3MOV R0,#00HMOV A,#67LJMP SONGCHU JJ3: CJNE R0,#4,JJ4MOV R0,#00HMOV A,#68LJMP SONGCHU JJ4: CJNE R0,#5,JJ5MOV R0,#00HMOV A,#69LJMP SONGCHU JJ5: CJNE R0,#6,JJ6MOV R0,#00HMOV A,#70LJMP SONGCHU JJ6: CJNE R0,#7,JJ7MOV R0,#00HMOV A,#71LJMP SONGCHU JJ7: CJNE R0,#8,JJ8MOV R0,#00HMOV A,#72LJMP SONGCHUJJ8: RETKEEP10: CJNE R0,#1,JJ9MOV R0,#00HMOV A,#73LJMP SONGCHU JJ9: CJNE R0,#2,JJ10MOV R0,#00HMOV A,#74LJMP SONGCHU JJ10: CJNE R0,#3,JJ11MOV R0,#00HMOV A,#75LJMP SONGCHU JJ11: CJNE R0,#4,JJ12MOV R0,#00HMOV A,#76LJMP SONGCHU JJ12: CJNE R0,#5,JJ13MOV R0,#00HMOV A,#77LJMP SONGCHU JJ13: CJNE R0,#6,JJ14MOV R0,#00HMOV A,#78LJMP SONGCHU JJ14: CJNE R0,#7,JJ15MOV R0,#00HMOV A,#79LJMP SONGCHU JJ15: CJNE R0,#8,JJ16MOV R0,#00HMOV A,#80LJMP SONGCHUJJ16: RETKEEP11: CJNE R0,#1,JJ17MOV R0,#00HMOV A,#81LJMP SONGCHU JJ17: CJNE R0,#2,JJ18MOV R0,#00HMOV A,#82LJMP SONGCHU JJ18: CJNE R0,#3,JJ19MOV R0,#00HMOV A,#83LJMP SONGCHU JJ19: CJNE R0,#4,JJ20MOV R0,#00HMOV A,#84LJMP SONGCHU JJ20: CJNE R0,#5,JJ21MOV R0,#00HMOV A,#85LJMP SONGCHU JJ21: CJNE R0,#6,JJ22MOV R0,#00HMOV A,#86LJMP SONGCHUJJ22: CJNE R0,#7,JJ23MOV R0,#00HMOV A,#87LJMP SONGCHU JJ23: CJNE R0,#8,JJ24MOV R0,#00HMOV A,#88LJMP SONGCHUJJ24: RETKEEP12: CJNE R0,#1,JJ25MOV R0,#00HMOV A,#89LJMP SONGCHU JJ25: CJNE R0,#2,JJ26MOV R0,#00HMOV A,#90LJMP SONGCHU JJ26: CJNE R0,#3,JJ27MOV R0,#00HMOV A,#91LJMP SONGCHU JJ27: CJNE R0,#4,JJ28MOV R0,#00HMOV A,#92LJMP SONGCHU JJ28: CJNE R0,#5,JJ29MOV R0,#00HMOV A,#93LJMP SONGCHU JJ29: CJNE R0,#6,JJ30MOV R0,#00HMOV A,#94LJMP SONGCHU JJ30: CJNE R0,#7,JJ31MOV R0,#00HMOV A,#95LJMP SONGCHU JJ31: CJNE R0,#8,JJ32MOV R0,#00HMOV A,#96LJMP SONGCHUJJ32: RETKEEP13: CJNE R0,#1,MM1MOV R0,#00HLJMP SONGCHU MM1: CJNE R0,#2,MM2MOV R0,#00HMOV A,#98LJMP SONGCHU MM2: CJNE R0,#3,MM3MOV R0,#00HMOV A,#99LJMP SONGCHU MM3: CJNE R0,#4,MM4MOV R0,#00HMOV A,#100LJMP SONGCHU MM4: CJNE R0,#5,MM5MOV R0,#00HMOV A,#101LJMP SONGCHU MM5: CJNE R0,#6,MM6MOV R0,#00HMOV A,#102LJMP SONGCHU MM6: CJNE R0,#7,MM7MOV R0,#00HMOV A,#103LJMP SONGCHU MM7: CJNE R0,#8,MM8MOV R0,#00HMOV A,#104LJMP SONGCHUMM8: RETKEEP14: CJNE R0,#1,MM9MOV R0,#00HMOV A,#105LJMP SONGCHU MM9: CJNE R0,#2,MM10MOV R0,#00HMOV A,#106LJMP SONGCHU MM10: CJNE R0,#3,MM11MOV R0,#00HMOV A,#107LJMP SONGCHU MM11: CJNE R0,#4,MM12MOV A,#108LJMP SONGCHU MM12: CJNE R0,#5,MM13MOV R0,#00HMOV A,#109LJMP SONGCHU MM13: CJNE R0,#6,MM14MOV R0,#00HMOV A,#110LJMP SONGCHU MM14: CJNE R0,#7,MM15MOV R0,#00HMOV A,#111LJMP SONGCHU MM15: CJNE R0,#8,MM16MOV R0,#00HMOV A,#112LJMP SONGCHUMM16: RETKEEP15: CJNE R0,#1,MM17MOV R0,#00HMOV A,#113LJMP SONGCHU MM17: CJNE R0,#2,MM18MOV R0,#00HMOV A,#114LJMP SONGCHU MM18: CJNE R0,#3,MM19MOV R0,#00HMOV A,#115LJMP SONGCHU MM19: CJNE R0,#4,MM20MOV R0,#00HMOV A,#116LJMP SONGCHU MM20: CJNE R0,#5,MM21MOV R0,#00HMOV A,#117LJMP SONGCHU MM21: CJNE R0,#6,MM22MOV R0,#00HMOV A,#118LJMP SONGCHUMM22: CJNE R0,#7,MM23MOV R0,#00HMOV A,#119LJMP SONGCHU MM23: CJNE R0,#8,MM24MOV R0,#00HMOV A,#120LJMP SONGCHUMM24: RETKEEP16: CJNE R0,#1,MM25MOV R0,#00HMOV A,#121LJMP SONGCHU MM25: CJNE R0,#2,MM26MOV R0,#00HMOV A,#122LJMP SONGCHU MM26: CJNE R0,#3,MM27MOV R0,#00HMOV A,#123LJMP SONGCHU MM27: CJNE R0,#4,MM28MOV R0,#00HMOV A,#124LJMP SONGCHU MM28: CJNE R0,#5,MM29MOV R0,#00HMOV A,#125LJMP SONGCHU MM29: CJNE R0,#6,MM30MOV R0,#00HMOV A,#126LJMP SONGCHU MM30: CJNE R0,#7,MM31MOV R0,#00HMOV A,#127LJMP SONGCHU MM31: CJNE R0,#8,MM32MOV R0,#00HMOV A,#128LJMP SONGCHUMM32: RET SONGCHU: MOV SBUF,AYY1: JBC TI,YYAJMP YY1 YY: RETEND。