Hi Sbe,

On 02/02/12 06:47 pm, Sebastien Lelong wrote:

there's no reason adc_read(30) works... maybe it reads all channels on
default?

Well, adc_read(30) simply and unconditionally reads ADC channel 30, like it would do with any other channel number. When the channel doesn't exist, or the pin is not setup correctly the returned value will not be meaningful! When the FVRCON register is setup for temperature measurement the temperature module is coupled to channel 30 and thus a value representing the temperature is returned. When the temperature module is not activated the returned value of channel 30 is all binary 1's. Similarly when the FVR module is enabled its output is coupled to ADC channel 31 and a value representing the voltage can be read with adc_read(31).

Regards, Rob.



Le 2 févr. 2012 16:49, "Rob Hamerling" <[email protected]
<mailto:[email protected]>> a écrit :

    FYI: I noticed that the 16f1527 has actually 32 ADC channels, of
    which channel 30 is to read the builtin temperature and channel 31
    to read the Fixed Voltage Reference (after configuring register
    FVRCON properly). And indeed: read_adc(30) and read_adc(31) do work
    properly!


--
R. Hamerling, Netherlands --- http://www.robh.nl

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to