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

📄 adccont.asm

📁 于ADuC812的智能无功补偿控制器的研制 一种眼科B型超声诊断议 SL11R单片机外部存储器扩展 单片机复位电路...支持键盘双击事件的C程序设计! 一些源程序 FrankLin C51 库函数的一
💻 ASM
字号:
;********************************************************************
;
; Author        : ADI - Apps            www.analog.com/MicroConverter
;
; Date          : April 2002
;
; File          : ADCcont.asm
;
; Hardware      : ADuC814
;
; Description   : Performs ADC conversions in continuous mode at a
;                 rate of 30.840KSPS (assuming an 2.097152 Mclk).
;                 Outputs ADC results into a buffer in ram.Continuously
;                 flashes LED.
;                 All rate calculations assume an 2.097152MHz Mclk.
;		
;********************************************************************

$MOD814                         ; Use 8052&ADuC812 predefined symbols

LED     EQU     P3.3            ; P3.3 drives red LED on eval board
CHAN    EQU     0               ; convert this ADC input channel..
                                ; ..chan values can be 0 thru 8


DSEG 
ORG 0030H
LENGTH EQU 40
BUFFER: DS LENGTH                ; set up buffer in RAM

;____________________________________________________________________
                                                  ; BEGINNING OF CODE
CSEG

ORG 0000h

        JMP     MAIN            ; jump to main program
;____________________________________________________________________
                                             ; INTERRUPT VECTOR SPACE
ORG 0033H ; (ADC ISR)
		CJNE    R0,#58H,CONT
                JMP     EXIT
CONT:		MOV     @R0,ADCDATAH
		INC     R0
		MOV     @R0,ADCDATAL		
		INC     R0
EXIT:		RETI

;====================================================================
                                                       ; MAIN PROGRAM
ORG 004Bh

MAIN:

; PRECONFIGURE...

        MOV     ADCCON1,#080h   ; power up ADC /32 clk cycle + 16 cycles for conversion + 1 acq cycle  
        MOV     ADCCON2,#CHAN   ; select channel to convert

; LAUNCH CONTINUOUS CONVERSIONS...
	MOV     R0,#BUFFER
        SETB	EA              ; enable interrupts
        SETB    EADC            ; enable ADC interrupt
        SETB    CCONV           ; begin continuous conversions

; CONTINUE WITH OTHER CODE...
	MOV     A,#1		; delay length
AGAIN:  CPL     LED             ; blink (complement) the LED
	CALL	DELAY		; delay
        JMP     AGAIN           ; repeat

; the micro is free to continue with other tasks (flashing the LED in
; this case) while the ADC is continuously converting, and results
; are being handled by the ADC interrupt service routine.

;____________________________________________________________________
                                                         ; SUBROUTINE
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 + -