📄 blnkdly.asm
字号:
;======================================================================
;
; Author : ADI - Apps
;
; Date : Febuary 2001
;
; Filename : bdelay.asm
;
; Hardware : ADuC814
;
; Description : Blinks LED continuously.
; 200mSec period @ 50% duty cycle.
; Pressing Int0 delays LED toggle rate by 200mSec
;
;======================================================================
;
$MOD814 ; Use ADuC814 predefined Symbols
LED EQU P3.3 ; P3.3 is red LED on eval board
FLAG BIT 00H ; define Flag variable
CSEG ; Defines the following as a segment of code
ORG 0000H ; Load Code at '00H'
JMP MAIN ; Jump to MAIN
;======================================================================
ORG 0003h ; (INT0 ISR)
INC A ; Increment Acc
RETI ; Return from Interrupt
;======================================================================
; Subroutines
;------------------------------------------------------------------
DELAY: ; Delays by 100ms * A
; 100mSec based on 2.097152MHZ
; Core Clock
; i.e. default ADuC814 Clock
MOV R1,A ; Acc holds delay variable
DLY0: MOV R2,#022h ; Set up delay loop0
DLY1: MOV R3,#0FFh ; Set up delay loop1
DJNZ R3,$ ; Dec R3 & Jump here until R3 is 0
DJNZ R2,DLY1 ; Dec R2 & Jump DLY1 until R2 is 0
DJNZ R1,DLY0 ; Dec R1 & Jump DLY0 until R1 is 0
RET ; Return from subroutine
;======================================================================
MAIN: ; (main program)
MOV SP,#02Fh ; Initialize SP
SETB IT0 ; INT0 edge triggered
SETB EA ; enable inturrupts
SETB EX0 ; enable INT0
CLR FLAG ; Clear Bit defined as FLAG
MOV A,#01H ; Initialize A -> 1
BLINK: CPL LED ; blink LED using compliment instruction
CALL DELAY ; Jump to subroutine DELAY
JNB FLAG,BLINK ; If FLAG is still cleared the jump to Blink
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -