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

📄 adc42go.asm

📁 ADUC842 C程序集,包括ADC,DAC,PLL,PWM,WDT等程序.
💻 ASM
字号:
;File: adc42go.a51
;Author: Eckart Hartmann Date:05/10/2003
 ; Development progress: Adc842.df
;
;AdcGo==========Start conversion(s).
;C Function prototype: char AdcGo(char cChan, char cMode);
;Description of Function: Start conversion on channel cChan with cMode mode.
;User interface: Set up the ADC using AdcCfg().
;		Set cChan to channel to convert.
;		For single conversion set cMode = 1, for continuous conversion
;		set cMode = 2 and for DMA conversion see note below.
;		Call AdcGo() which starts conversion according to mode bits.
;		Returns (corrected) cChan.
;		Note: for DMA conversion prepare the destination RAM as 
;		described in the data sheet. Then set cMode to 4 and call
;		AdcGo(). Then set cMode to 6 for continuous conversions  or 5 
;		for single conversions and call AdcGo again to start conversions.
;Robustness: AdcBsy() should be used to check for completion.
;		Invalid cChan will be changed to 12.
;Side effects: Overwrites a, c, P.
;
NAME ADCGO
$NOMOD51
 $IC(..kei842.inc) ; Parameter passing registers for Keil .
 $IC(..kei842.dat) ; SFR definition for Keil .
;
public _AdcGo
;
?PR?_AdcGo?ADCGO	SEGMENT CODE
	RSEG	?PR?_AdcGo?ADCGO
;
_AdcGo:	mov	a,cP1l		;if(cChan>12)
	add	a,#0f3h
	jnc	AdGo
	mov	cP1l,#12	; cChan = 12;
AdGo:	mov	ADCCON2,cP1l	;Set mux.
	mov	a,cP2lc		;ADCCON2 = cChan+(cMode<<4);
	anl	a,#7
	swap	a
	orl	a,cP1l
	mov	ADCCON2,a	;	//Start conversion
	ret
;
;Function End==========================================================Function End
END

⌨️ 快捷键说明

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