新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > 基于AT89C2051的紅外遙控學習器源程序

基于AT89C2051的紅外遙控學習器源程序

作者: 時間:2010-12-09 來源:網(wǎng)絡 收藏

本文引用地址:http://m.butianyuan.cn/article/173092.htm

CLR TR0
L1: MOV C,JIEDUAN
JC L1
L4: SETB TR0
L2: MOV C,JIEDUAN
CLR TR0
MOV @R0,TL0
INC R0
MOV TH0,#00H
MOV TL0,#00H
L6: SETB TR0
L3: MOV C,JIEDUAN
JC L3
CLR TR0
CLR C
MOV A,TL0
ADDC A,#13H
MOV @R0,A
INC R0
MOV TH0,#00H
MOV TL0,#00H
SETB TR0
L5: MOV C,JIEDUAN
JNC L5
CLR TR0
CLR C ;1
MOV A,TL0 ;1
ADDC A,#13H ;1
MOV @R0,A ;2
INC R0
MOV A,TH0
ADDC A,#00H
MOV @R0,A
INC R0
MOV TH0,#00H
MOV TL0,#00H
SJMP L6
SHUJIAN: SETB JIEXUAN
MOV @R0,#DATABEG1
INC R0
MOV @R0,#DATABEG2
SETB EX0
CLR F0
NEXT13: JB F0,NEXT12
LJMP NEXT13
NEXT12: LCALL WRITEP
SETB JIELIGHT
RET
TIME0OUT CLR ET0
CLR TR0
MOV DPTR,#SHUJIAN
MOV @R1,DPH
DEC R1
MOV @R1,DPL
RETI
KEYPRESS: CLR EX0
MOV R3,#0DH
CYCLE3: MOV R4,#0FFH
CYCLE2: DJNZ R4,CYCLE2
DJNZ R3,CYCLE3
MOV C,INTRPO
JNC NEXT1
RETI
NEXT1: SETB F0
MOV C,P1.0
MOV ACC.0,C
MOV C,P1.1
MOV ACC.1,C
MOV C,P1.2
MOV ACC.2,C
CLR P1.0
CLR P1.1
CLR P1.2
SETB P1.3
SETB P1.4
SETB P1.5
MOV C,P1.3
MOV ACC.3,C
MOV C,P1.4
MOV ACC.4,C
MOV C,P1.5
MOV ACC.5,C
ANL A,300111111B
MOV JIANMA,A
SETB P1.0
SETB P1.1
SETB P1.2
CLR P1.3
CLR P1.4
CLR P1.5
LCALL JIANWEIP
RETI
JIANWEIP: CJNE JIANMA,#36H,NEXT14
MOV JIANWEI,#01H
LJMP LAST
NEXT14: CJNE JIANMA,#35H,NEXT15
MOV JIANWEI,#02H
LJMP LAST
NEXT15: CJNE JIANMA,#35H,NEXT16
MOV JIANWEI,#03H
LJMP LAST
NEXT16: CJNE JIANMA,#2EH,NEXT17
MOV JIANWEI,#04H
LJMP LAST
NEXT17: CJNE JIANMA,#2DH NEXT18
MOV JIANWEI, #05H
LJMP LAST
NEXT18: CJNE JIANMA,#2BH,NEXT19
MOV JIANWEL,#06H
LJMP LAST
NEXT19: CJNE JIANMA,#1EH,NEXT20
MOV JIANWEI,#07H
LJMP LAST
NEXT20: CJNE JIANMA,#1DH,NEXT21
MOV JIANWEL,#09H
LJMP LAST
NEXT21: CJNE JIANMA,#1BH,NEXT22
MOV JIANWEI,#09H
LJMP LAST
NEXT22: CLR FO
LAST: RET
READP: MOV RO,BUFBEGIN
MOV A,JIANWEI
MOV B,50
MUL AB
MOV R3,A
SHU JU DI ZHI
INC R3
LCALL READCOM
READNET2: MOV A,R3
LCALL WRITEADRESS
LCALL READBYTE
CJNE ,#DATABEG1,READNET1
MOV A R3
INC A
LACLL WRITEADRESS
LCALL READBYTE
CJNE A,#DATABEG2,READNET1
CLR CS
RET
READNET1: MOV @RO,A
INC RO
INC R3
LJMP READNET2
WRITEP: MOV RO,BUFBEGIN
MOV A,JIAWEI
MOV B,50
MUL AB
MOV R3,A ;KAI SHI SHU
JU DI ZHI
INC R3
LCALL EWEN
WRITNET1: LACLL WRITECOM
MOV,R3
LCALL WRITEADRESS
MOV A,@RO
CJNE A,#DATABEG1,WRITNET2
INC RO
MOV A,@RO
CJNE A,DATABEG2,WRITNET3
LCALL EWDS
CLR CS
RET



評論


相關(guān)推薦

技術(shù)專區(qū)

關(guān)閉