📄 tim2_ar.asm
字号:
;====================================================================
;
; Author : ADI - Apps
;
; Date : 2nd July 2003
;
; File : Tim2_AR.asm
;
; Hardware : ADuC845
;
; Description : Flashes light every 65536 machine cycles (@ 24Hz
; for core freq = 1.5725MHz) using timer 2 in Auto
; Reload Mode.
;____________________________________________________________________
$MOD845 ;Use 8052 predefined Symbols
LED EQU P3.4
;____________________________________________________________________
; BEGINNING OF CODE
CSEG
ORG 0000H
JMP MAIN
;____________________________________________________________________
; TIMER 2 INTERRUPT ROUTINE
ORG 002Bh
CPL LED ; Flash the light
CLR TF2 ; The TF2 flag must be cleared in software
RETI
;____________________________________________________________________
; MAIN PROGRAM
ORG 0060h ; Start code at address above interrupts
MAIN: ; Main program
SETB ET2 ; Enable timer2 interrupt
MOV TL2, #00h ; Initialise timer 2 registers & Reload
MOV TH2, #00h ; values to rollover every 65536
MOV RCAP2L, #00h ; machine cycles
MOV RCAP2H, #00h
SETB EA ; Enable interrupts
MOV T2CON, #04h ; Start timer 2 in 16-bit reload mode
JMP $ ; Wait here for timer Interrupts
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -