"); //-->
---------------------------------------------------------------------------
;直接读出家用红外线遥控器的地址码,和数据,适用于DSB-1A型实验板.
COUNTER EQU 41H
DISPBUF EQU 45H
DIZHI EQU 56H
COUN EQU 55H
COUN1 EQU 38H
CC EQU 39H
FASH BIT 37H
FASH1 BIT 35H
ORG 0000H
AJMP START
ORG 001BH
AJMP DISP
ORG 30H
START: MOV SP,#5FH
MOV DIZHI,#00H
MOV DIZHI+2,#00H
MOV DISPBUF,#0
MOV DISPBUF+1,#0
MOV DISPBUF+2,#16
MOV DISPBUF+3,#16
MOV DISPBUF+4,#0
MOV DISPBUF+5,#0
MOV COUN,#0
MOV COUN1,#0
CLR FASH
CLR FASH1
MOV TMOD,#00010001B
MOV TH1,#HIGH(65536-3676)
MOV TL1,#LOW(65536-3676)
SETB TR1
SETB EA
SETB ET1
LOOP:
JB P3.2,LOOP
MOV R6,#10
K1: ACALL DELAY
JB P3.2,LOOP
DJNZ R6, K1
JNB P3.2,$
JNB FASH1,K2
MOV R7,#100
SETB FASH1
AJMP LOOP
K2: JB P3.2,$
MOV R1,#DIZHI
MOV R2,#4
K3: MOV R3,#8
K5: JNB P3.2,$
ACALL DELAY
MOV C,P3.2
MOV CC,C
JNC K4
JB P3.2,$
K4: MOV A,@R1
RRC A
MOV @R1,A
DJNZ R3,K5
INC R1
DJNZ R2,K3
SETB FASH1
SETB FASH
MOV A,DIZHI
CJNE A,#10H,LOOP
MOV A,DIZHI+2
CJNE A,#0C6H,EXP
AJMP KEY0
EXP: CJNE A,#0C3H,EXT
AJMP KEY1
EXT: CJNE A,#89H,EXE
AJMP KEY2
EXE: CJNE A,#0C0H,LOOP
CPL P1.3
AJMP LOOP
KEY0: CPL P1.0
AJMP LOOP
KEY1: CPL P1.1
AJMP LOOP
KEY2: CPL P1.2
JNB P3.2,$
JB P3.2,$
JNB P3.2,$
ajmp loop
DELAY: MOV 70H,#16 ;延时1 (0.82ms)
D1: MOV 71H,#21
DJNZ 71H,$
DJNZ 70H,D1
RET
DISP:
PUSH ACC
PUSH PSW
PUSH CC
MOV TH1,#HIGH(65536-3676)
MOV TL1,#LOW(65536-3676)
JNB FASH1,F8
DEC R7
CJNE R7,#0,F8
CLR FASH1
F8: JNB FASH,F2
INC COUN1
MOV A,COUN1
CJNE A,#50,F2
MOV COUN1,#0
MOV A,DIZHI+2
MOV B,#16
DIV AB
MOV DISPBUF,B
MOV DISPBUF+1,A
MOV A,DIZHI
MOV B,#16
DIV AB
MOV DISPBUF+4,B
MOV DISPBUF+5,A
F2: MOV P2,#0FFH
MOV A,COUNTER
MOV DPTR,#BITTAB
MOVC A,@A+DPTR
MOV P2,A
MOV P0,#0FFH
MOV A,#DISPBUF
ADD A,COUNTER
MOV R0,A
MOV A,@R0
MOV DPTR,#DISPTAB
MOVC A,@A+DPTR
MOV P0,A
INC COUNTER
MOV A,COUNTER
CJNE A,#6,D8
MOV COUNTER,#0
D8:
POP CC
POP PSW
POP ACC
RETI
BITTAB:DB 0FBH,0F7H,0EFH,0DFH,0BFH,07FH
DISPTAB:DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H,88H,83H,0C6H,0A1H,86H,8EH,0BFH
END
*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。