Hi Seb,

> Does it work with 9 ? I'm asking because 9 would give 6 analog pins, since
> 16f876a has only 5 analog pins, I was wondering if it'd work (5 analogs
> being included in 6).
Yes it does.

> This also explains the behavior. ADC lib generator/template is tricky about
> this, when multiple PICs with different analog pins number. I'll try to fix
> this to get a proper code. But which would it be ? Consider table page 128,
> datasheet 39582. ADC lib template actually consider all possibilities, one
> possibility overwriting the prior one. So when deciding which config bits it
> should keep for 5 analogs and 0 vref, it has considered 0b000, then replaced
> it with 0b0010 (the one you'd like), then 0b1001.
I guess this is related to the way the library works internally (which
I did not understand yet ;).
If it works the same for 16f877, you get 6 analog pins, while you
request 5. So one pin won't work in digital mode as one would
expect...

Maybe it requires a statement like:
if (ADC_NVREF == 0) then
    if (ADC_NCHANNEL == 0) then
       ADCON1_VALUE = 0x0
    elseif (ADC_NCHANNEL == 1)
       ADCON1_VALUE = 0xE
and so on...

Much code - a value for each line in the table - but resolved
compiletime when both are constants...

Joep

-- 
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