基于AT89C2051的红外遥控学习器源程序
6 源程序
ORG 0000H
AJMP MAIN
ORG 0003H
AJMP KEYPRESS
ORG 000BH
AJMP TIMEOUT
ORG 001BH
AJMP TIMEOUT
SENDDUAN BIT P3.0
JIEDUAN BIT P3.1
INTRPO BIT P3.2
JIEXUAN BIT P3.3
SENDLIGHT BIT P3.4
JIELIGHT BIT P3.5
CS BIT P3.7
DATADUAN BIT P1.6
CLK BIT P1.7
JIANWEI EQU R5
JIANMA EQU R6
SHANGJIAN EQU 07H;R7
OPENKEY EQU 81H
CLOSEKEY EQU 00H
CHUT0 EQU 11H
CHUT1 EQU 11H
BUFBEGIN EQU 18H
OPENT1 EQU 88H
CLOSET1 EQU 00H
OPENT0 EQU 82H
CLOSET0 EQU 00H
DATABEG1 EQU 0AAH
DATABEG2 EQU 33H
ORG 0030H
MAIN: MOV IE,#80H
MOV IP,#00H
MOV P3,#0FFH
CLR CS
SETB P1.0
SETB P1.1
SETB P1.2
CLR P1.3
CLR P1.4
CLR P1.5
CLR P1.6
CLR P1.7
MOV R3,#80H
MOV R0,00H
CYCLE1: MOV @R0,#00H
INC R0
DJNZ R3,CYCLE1
MOV PSW,#00H
MOV SP,#07H
MOV TMOD,#11H
MOV TCON,#00H
START: MOV SP,#07H
SETB SENDDUAN
CLR F0
SETB EXO
WAITKEY: MOV C,F0
JNC WAITKEY
CJNC JIANMA,#1BH,SEND
LCALL LEARNP
LJMP START
SEND: LCALL SENDP
LJMP START
SENDP: SETB SENDDUAN
CLR F0
MOV TMOD,#CHUT1