单片机源程序如下:
ORG 0000
LJMP 0026H
LJMP 00B2H
CLR ES ;禁止串行中断
MOV SBUF,22H ;启动发送
JNB TI,$ ;如果TI为零,原地转移
CLR TI;清发送中断位置
SETB ES ;允许串口中断
RETI ;中断返回
LJMP 0006H
MOV P0,22H
MOV R7,#01H
MOV R6,#00H
LJMP 0120H
NOP;空指令
NOP
NOP
LJMP 014CH
MOV R0,#7FH
CLR A
MOV @R0,A
DJNZ R0,0029H
MOV SP,#22H
LJMP 006DH
LJMP 00FDH
CLR A
MOVC A,@A+DPTR
INC DPTR ;+1
MOV R0,A
CLR A
MOVC A,@A+DPTR
INC DPTR
JC 0041H
MOV @R0,A
SJMP 0042H
MOVX @R0,A
INC R0
DJNZ R7,0039H
SJMP 0070H
CLR A
MOVC A,@A+DPTR
INC DPTR
MOV R0,A
ANL A,#07H
ADD A,#0CH
XCH A,R0
CLR C
RLC A
SWAP A
ANL A,#0FH
ORL A,#20H
XCH A,R0
MOVC A,@A+PC
JC 005FH
CPL A
ANL A,@R0
SJMP 0060H
ORL A,@R0
MOV @R0,A
DJNZ R7,0047H
SJMP 0070H
AJMP 0002H
INC A
INC R0
JBC 24H.0,00ACH
SJMP 0FFFEH
AJMP 0036H
CLR A
MOV R6,#01H
MOVC A,@A+DPTR
JZ 0032H
INC DPTR
MOV R7,A
ANL A,#3FH
JNB ACC.5,0086H
ANL A,#1FH
MOV R6,A
CLR A
MOVC A,@A+DPTR
INC DPTR
JZ 0086H
INC R6
XCH A,R7
ANL A,#0C0H
ADD A,ACC
JZ 0035H
JC 0047H
CLR A
MOVC A,@A+DPTR
INC DPTR
MOV R2,A
CLR A
MOVC A,@A+DPTR
INC DPTR
MOV R0,A
CLR A
MOVC A,@A+DPTR
INC DPTR
XCH A,R0;交换
XCH A,DPL
XCH A,R0
XCH A,R2
XCH A,DPH
XCH A,R2
MOVX @DPTR,A
INC DPTR
XCH A,R0
XCH A,DPL
XCH A,R0
XCH A,R2
XCH A,DPH
XCH A,R2;交换
DJNZ R7,0097H
DJNZ R6,0097H
SJMP 0070H
PUSH ACC
PUSH B
PUSH PSW
MOV PSW,#08H
MOV R5,#0FEH
MOV R4,#01H
MOV A,P1
ANL A,R5
XRL A,P1
JNZ 00DEH
MOV R6,0CH
MOV R3,A
MOV A,#1DH
ADD A,R3
MOV R0,A
MOV A,@R0
MOV P1,A
MOV A,P1
ANL A,R5
CJNE A,P1,00DAH
MOV R7,0BH
SJMP 00DEH
INC R3
CJNE R3,#04H,00C9H
MOV A,R5
ADD A,ACC
ORL A,#01H
MOV R5,A
INC R4
CJNE R4,#04H,00BFH
MOV A,R7
MOV B,#03H
MUL AB
ADD A,R6
MOV 21H,A
ADD A,#10H
MOV R0,A
MOV A,@R0
MOV 22H,A
POP PSW
POP B
POP ACC
RETI
MOV SCON,#50H
CLR A
MOV PCON,A
MOV TMOD,#20H
MOV TH1,#0F3H
MOV TL1,#0F3H
SETB TR1
SETB EA
SETB EX0
SETB EX1
SETB ES
MOV P0,A
MOV P1,#07H
LCALL 0016H
SJMP 0118H
MOV A,R7
DEC R7
MOV R2,06H
JNZ 0127H
DEC R6
ORL A,R2
JZ 0135H
CLR A
MOV R5,A
MOV A,R5
CLR C
SUBB A,#0FFH;A的内容-1存入0FFH
JNC 0120H
INC R5
SJMP 012CH
RET
INC R5
JBC 20H.0,0140H
ANL A,R3
ORL A,R7;或操作
XRL A,@R0;异或
XRL A,R5;异或
MOV R5,#07H
MOV R7,#6FH
ADDC A,R1
ADDC A,R7
MOV @R0,#04H
DEC R5
MOV @R1,A
MOV A,R7
DJNZ R7,010AH
NOP
CLR RI
MOV 22H,SBUF;读接收数据
RETI ;中断返回
END
全部资料51hei下载地址:
双机.zip
(30.33 KB, 下载次数: 39)
|