📄 prog25.asm
字号:
; PROG25 - Timer Interrupt Handler without Context Saving
;
; This Application Decrements the Value in P1 Once Per Second
;
; Myke Predko
; 98.03.01
;
; Hardware Notes:
; 80C520 Running at 4 MHz
; The 80C520's Clock will be running at 1/4 Second "Ticks"
; P1 is Connected to a Set of LEDs
; P3 is Connected to an External LED Diplay
; Variable Declarations
; R0 is Used as the Interrupt Count
; R1/R2/R3 are Used for the External Display Count
org 0
ajmp Mainline
org 0Bh ; Timer0 (Real Time) Interrupt
djnz R0,IntSkip ; One Second Up?
dec P1 ; Decrement the Timer Display
mov R0,#15 ; Reset the Counter
IntSkip:
reti
org 020h ; Program Mainline
Mainline:
mov R0,#15 ; Want to Change the Value once Every 4 Times
mov CKCON,#%00001000 ; Use Internal /4 Clock for Timer0
mov TMOD,#%00000001 ; Timer0 - Uses Internal Clock
; - Run in Mode 1
mov TCON,#%00010000 ; Start Timer0 running
mov IE,#%10000010 ; Enable the Timer 0 Interrupt
; Now, Do the Looping Output
MainLoop: ; Come Back Here After Decrementing P3
mov R1,#0 ; Setup for the Delay
mov R2,#0
mov R3,#4
DlayLoop: ; Loop Here for Delays
djnz 1,DlayLoop
djnz 2,DlayLoop
djnz 3,DlayLoop
dec P3 ; Decrement the LED Output
ajmp MainLoop ; Wait to Decrement the Next Time
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -