微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > STC单片机学习型遥控器程序

STC单片机学习型遥控器程序

时间:05-11 来源:互联网 点击:


BYTE_READ: INC R0
MOV ISP_ADDRH,ADDRH
MOV ISP_ADDRL,R0
DEC R0
CLR EA
MOV ISP_CONTR,#WAIT_TIME
ORL ISP_CONTR,#10000000B
MOV ISP_CMD,#ISP_CMD_READ
MOV ISP_TRIG,#46H
MOV ISP_TRIG,#0B9H
NOP
MOV A,ISP_DATA
MOVX @R0,A
RET


TX_EXROM: MOV TMOD,#00010010B
MOV TH0,#0F4H
MOV TL0,#0F4H
MOV R1,GESHU
MOV R0,#00H
MOVX A,@R0
MOV TL1,A
INC R0
MOVX A,@R0
MOV TH1,A
INC R0
DEC R1
MOVX A,@R0
MOV ZHIL,A
INC R0
MOVX A,@R0
MOV ZHIH,A
INC R0
DEC R1

SETB ET1
SETB ET0
SETB EA
SETB TR1
SETB TR0
CLR TXOUT

MAIN2:CJNE R1,#00H,MAIN2
CLR TXOUT
mov p1,#55h
LJMP KEY_MAIN


T0IN:CPL TXZAI
RETI

T1IN: MOV TL1,ZHIL
MOV TH1,ZHIH
JB TR0,NEXTT1
SETB TR0
LJMP NEXTT
NEXTT1:CLR TR0
CLR TXZAI

NEXTT:CPL TXOUT
MOVX A,@R0
MOV ZHIL,A
INC R0
MOVX A,@R0
MOV ZHIH,A
INC R0
DJNZ R1,OUTTI
CLR TR1
CLR TR0
CLR TXZAI
CLR TXOUT
OUTTI:RETI

DELAYXMS:MOV R7,#255
DEL1:MOV R6,#4
DEL2:MOV R5,#5
DJNZ R5,$
DJNZ R6,DEL2
DJNZ R7,DEL1
RET

DELAYX2MS:MOV R7,#255
DEL12:MOV R6,#50
DEL22:MOV R5,#50
DJNZ R5,$
DJNZ R6,DEL22
DJNZ R7,DEL12
RET


END

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top