标签:添加 中断 需要 timer asm 闪烁 计算 dtc inf
WDTCCR EQU 0FEA0H
CLR A
MOV DPTR,#WDTCCR
MOVX @DPTR,A ; 关闭看门狗
EA BIT 0A8H.7
TCON DATA 088H
IE DATA 0A8H
TL1 DATA 08BH
TH1 DATA 08DH
TMOD DATA 089H
TCON1 EQU 0FE80H
CLR A
MOV DPTR,#TCON1
MOVX @DPTR,A
MOV TMOD,A
MOV TH1,#0FAH
MOV TL1,#0CBH
ORL IE,#08H
ORL TCON,#040H
SETB EA
程序前80H作为中断向量地址需要跳过,并且使用了T1中断需要添加转移
ORG 00H
AJMP MAIN
ORG 01BH
AJMP TIME1
ORG 80H
$NOMOD51
P0_0 BIT 080H.0
EA BIT 0A8H.7
TCON DATA 088H
IE DATA 0A8H
TL1 DATA 08BH
TH1 DATA 08DH
TMOD DATA 089H
CLKSWR DATA 08EH
WDTCCR EQU 0FEA0H
CLKDIV EQU 0FE91H
TCON1 EQU 0FE80H
P0M0 EQU 0FF00H
ORG 00H
AJMP MAIN
ORG 01BH
AJMP TIME1
ORG 80H
MAIN:
USING 0
MOV R0, #00H
CLR A
MOV DPTR,#WDTCCR
MOVX @DPTR,A
MOV CLKSWR,#051H
MOV DPTR,#CLKDIV
INC A
MOVX @DPTR,A
MOV DPTR,#P0M0
MOVX A,@DPTR
ANL A,#0F0H
ORL A,#08H
MOVX @DPTR,A
CLR A
MOV DPTR,#TCON1
MOVX @DPTR,A
MOV TMOD,A
MOV TH1,#0FAH
MOV TL1,#0CBH
ORL IE,#08H
ORL TCON,#040H
SETB EA
DELAY:
SJMP DELAY
TIME1:
USING 0
CJNE R0, #0C8H, exit
CPL P0_0
MOV R0, #00H
exit:
INC R0
RETI
END
标签:添加 中断 需要 timer asm 闪烁 计算 dtc inf
原文地址:https://www.cnblogs.com/yywBlogW/p/11386652.html