⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pdown.asm

📁 于ADuC812的智能无功补偿控制器的研制 一种眼科B型超声诊断议 SL11R单片机外部存储器扩展 单片机复位电路...支持键盘双击事件的C程序设计! 一些源程序 FrankLin C51 库函数的一
💻 ASM
字号:
;********************************************************************
;
; Author        : ADI - Apps            www.analog.com/MicroConverter
;
; Date          : Febuary 2001
;
; File          : PDown.asm
;
; Hardware      : ADuC84
;
; Description   : Demonstrates a use of a timer interval counter to
;		wake the ADuC814 out of Power down mode after a user
;		specified Power down time.
;
;		The LED will, on power up, flash at 10Hz. After 5s
;		the ADuC8414 will enter power down mode (the LED will 
;		stop flashing in the off position). 
;		
;		By pressing the external interrupt 0 button (INT0) or
;		when the user specified time runs out (20s in this 
;		example) the ADuC814 will wake up and continue 
;		blinking as before for 5s before entering power down
;		mode again.
;
;********************************************************************

$MOD814                         ; Use 8052&ADuC814 predefined symbols

LED     EQU     P3.3            ; P3.3 drives red LED on eval board

;____________________________________________________________________
                                                  ; BEGINNING OF CODE
CSEG

ORG 0000h

        JMP     MAIN            ; jump to main program


;____________________________________________________________________
                                    ; EXTERNAL INTERRUPT VECTOR SPACE
ORG 0003h 	
	RETI

;____________________________________________________________________
                                         ; TIC INTERRUPT VECTOR SPACE
ORG 0053h
	RETI
;_____________________________________________________________________

ORG 0060h

MAIN:			
        MOV     IEIP2, #0A4h    ; enable time interval interrupt
        
	SETB	IT0             ; INT0 edge triggered
        SETB    EX0             ; enable INT0 (button on eval board)
	SETB    EA              ; enable interrupts

	MOV     INTVAL, #14h    ; initialise intval to 20 
                                ;     => 20 unit delay

BLINK:  MOV     R0, #50       
       
LOOP:   MOV     A, #01          ; Blink light 50 times at 10Hz =>5s
        CALL    DELAY
        CPL     LED
        DJNZ    R0, LOOP

	MOV	TIMECON, #13h  ; initialise timecon to 
		               ; -count in secs
	                       ; -start all time counters     

        CLR     LED            ; turn off light when in power down
        MOV     PCON, #22h     ; power down the ADuC814
                               ; Execution stops here until the ADuC
                               ; is powered up again by either an 
                               ; external interrupt or a Time Interval
                               ; Interrupt (20s)
                               ; Note: if using external data mem 
                               ; make sure ALE remains toggling after
                               ; you power up again. i.e. PCON.4=0
 
        MOV	TIMECON, #12h  ; disable TCEN to reset counter to 0
                               ; and to temporarily stop counter 
        JMP     BLINK
        

;____________________________________________________________________
                                                              ; DELAY

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


;____________________________________________________________________

END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -