;File: adc42get.a51
;Author: Eckart Hartmann Date:05/10/2003
 ; Development progress: Adc842.df
;
;AdcGet==========Get ADC conversion.
;C Function prototype: int AdcGet(char cChan);
;Description of Function: Does a complete conversion on channel cChan with
;	cMode mode.
 ; User interface: Set up the ADC using AdcCfg() .
;		Set cChan to channel to convert.
;		Call AdcGet(). This starts a single conversion on channel
;		cChan then waits for conversion to complete and returns
;		conversion result.
;Robustness: Invalid cChan will be changed to 12..
;Side effects: Overwrites a, P, c, r0 and uses 2 stack bytes.
;
NAME ADCGET
$NOMOD51
 $IC(..kei842.inc) ; Parameter passing registers for Keil .
 $IC(..kei842.dat) ; SFR definition for Keil .
;
extrn CODE (_AdcGo)
extrn CODE (AdcBsy)
extrn CODE (AdcRd)
public _AdcGet
;
?PR?_AdcGet?ADCGET	SEGMENT CODE
	RSEG	?PR?_AdcGet?ADCGET
;
_AdcGet:
mov cP2lc,#1 ; AdcGo(cChan,1) ; 
	lcall	_AdcGo
AdGBsy: mov a,ADCCON3 ; while( AdcBsy() ); 
	jb	ACC.7,AdGBsy
lcall AdcRd ; return AdcRd() .
	ret
;
;Function End==========================================================Function End
END

