[En-Nut-Discussion]Problem with ADC

Ole Reinhardt ole.reinhardt at kernelconcepts.de
Mon May 22 21:16:44 CEST 2006


Hi,

> Vadc = ADCRead() * Vref / 1024

Yes, you can calculate the value this way. You'll always get a 10 bit
value.

> is right?because i found diffent answers in the last discussions.
> Cn i set the aref with this fuction: void *ADCSetRef* (adc_ref_t reference)?

Yes, you can set it to AVCC, AREF, and INTERNAL_256 which corresponds to
the three possible settings the adc of the avr can work with. You can
not directly set a random voltage value as reference.

> how can i set the sampling frequency?
>  and the last question is: int *ADCBufRead*
> (u_short<http://www.ethernut.de/api/group__xgNutOS.html#ga1>*buf,
> u_short <http://www.ethernut.de/api/group__xgNutOS.html#ga1> *read) int *
> ADCBufWrite* (u_short <http://www.ethernut.de/api/group__xgNutOS.html#ga1>*buf,
> u_short <http://www.ethernut.de/api/group__xgNutOS.html#ga1> *write) void *
> ADCBufInit* (u_short <http://www.ethernut.de/api/group__xgNutOS.html#ga1>*buf)
> 
> what do these fuctions do?
> with a buffer what can i do?
> thanks for your helps.

Sorry, i don't have my code ready right now. I could answer you these
questions a little later when I'm back in office. AFAIK these buffers
are for internal usage only and you definatly should use adcread.


Br,

Ole Reinhardt

-- 
kernel concepts    Tel: +49-271-771091-14
Dreisbachstr. 24   Fax: +49-271-771091-19
D-57250 Netphen    E+ : +49-177-7420433
--





More information about the En-Nut-Discussion mailing list