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

📄 pdown.asm

📁 大量ADuc831的程序员代码
💻 ASM
字号:
;********************************************************************
;
; Author        : ADI - Apps            www.analog.com/MicroConverter
;
; Date          : Feb 2002
;
; File          : PDown.asm
;
; Hardware      : ADuC831
;
; Description   : Demonstrates a use of a timer interval counter to
;		wake the ADuC831 out of Power down mode after a user
;		specified Power down time.
;
;		The LED will, on power up, flash at 10Hz. After 5s
;		the ADuC831 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 ADuC831 will wake up and continue 
;		blinking as before for 5s before entering power down
;		mode again.
;
;********************************************************************

$MOD831                         ; Use 8052&ADuC831 predefined symbols

LED     EQU     P3.4            ; P3.4 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     

        SETB    LED            ; turn off light when in power down
        MOV     PCON, #22h     ; power down the ADuC824
                               ; 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 11.0592MHZ 
					; Core Clock 
					
		MOV	R5,A		; Acc holds delay variable
 DLY0:		MOV	R6,#200		; Set up delay loop0
 DLY1:		MOV	R7,#229		; Set up delay loop1
		DJNZ	R7,$		; Dec R2 until R2 is zero
		DJNZ	R6,DLY1         ; Dec R1 & Jump DLY1 until R1 is 0
		DJNZ	R5,DLY0		; Dec R0 & Jump DLY0 until R0 is 0
		RET			; Return from subroutine
;____________________________________________________________________

END

⌨️ 快捷键说明

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