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

📄 pllcon.asm

📁 于ADuC812的智能无功补偿控制器的研制 一种眼科B型超声诊断议 SL11R单片机外部存储器扩展 单片机复位电路...支持键盘双击事件的C程序设计! 一些源程序 FrankLin C51 库函数的一
💻 ASM
字号:
;********************************************************************
;
; Author        : ADI - Apps            www.analog.com/MicroConverter
;
; Date          : March 2001
;
; File          : pllcon.asm
;
; Hardware      : ADuC814
;
; Description   : Demonstrates that the CPU can run at different 
;               speeds determined by the CD bits in the PLLCON SFR. 
;               2 to the power of CD (a 3 bit number), is the divider 
;               ratio that determines the clock frequency at which 
;               the CPU will run. (CD=0 =>fcore=16.777216MHz, 
;               CD=7 => fcore=131.072kHz) 
;
;		The program turns on and off the LED approx every 
;               70,000 machine cycles. With the higher frequency 
;		(CD=0 =>fcore=16.777216MHz) the LED toggles at about 
;               10Hz. By pressing the INT0 button the CD bit is 
;               incremented (CD=1 =>fcore=8.388MHz) and the LED will 
;               toggle at half the frequency as before. At the 
;               minimum frequency (CD=7, fcore=131.072kHz) the LED 
;               toggles at 2.777Hz. By pressing INT0 button again 
;               CD rolls over to 0 again and the LED
;		toggles at 16Hz 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
;____________________________________________________________________
                                             ; INTERRUPT VECTOR SPACE
ORG 0003h ;  (INT0 ISR)
	
	CPL	LED		; complemant LED to indicate INT0 
		                ; press.
	MOV     R2,#136    	; reinitialise R7 and R6 so that       
	MOV     R3,#256		; after interrupt the full delay 
		                ; loop is completed

        MOV     A, PLLCON     ; Only increment CD bits of PLLCON
        INC     A             ; Rollover to PLLCON = xxxxx000b (fmax) 
        ANL     A, #07h       ; after PLLCON = xxxxx111b (fmin)
        MOV	PLLCON, A     ; where the x's are 1's and 0's as rqd	
				
	RETI

;====================================================================

ORG 0060H                    ; Start code at address above interrupts
MAIN:
	MOV	PLLCON, #00H
	SETB	IT0
        SETB    EX0             ; enable ext int INT0 
                                ; (button on eval board)
	SETB    EA              ; enable interrupts

BLINK:	CPL 	LED		
	CALL	DELAY		; wait for 70,000 machine cycles
                                ; =24ms at fmax
                                ; =3.1875s at fmin
	JMP	BLINK	


;====================================================================
DELAY:                      ; This loop delays the program for 70,000
                            ; (approx) machine cycles, corresponding 
                            ; to a delay of 66ms at fmax and 8.4s 
                            ; at fmin

        MOV     R2,#136         ; 136 * 256 * 0.715us = 24ms
DLY1:   MOV     R3,#256         ; 
        DJNZ    R3,$            ; sit here for 256 x 2 x machine 
                                ; cycle time 
        DJNZ    R2,DLY1       ; repeat 136 times (=24ms total @ fmax)
        RET

;____________________________________________________________________

END

⌨️ 快捷键说明

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