2010/10/4 Joep Suijs <[email protected]> > 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. >
OK > > > 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 ;). > As you know there are many, many information used by ADC lib template, initially coming from datasheet parsing then manually maintained (mostly by Rob I must admit). So the template compiles all of these information, in the end that's not easy to follow. But since it's python, it's easy to debug, just print what you want, it'll show you the guts :) > 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... > No, I don't think so, if you look at adc_channels.jal, line 460, ADC_PCFG_MAP is defined for 16f877a. If you read the array triplet by triplet, you'll see 5 ADC channels config is different from 6. You'll also see 5/0 is configured with 0b0010 in this case, and 6 is configured with 0b1001... If you want more information, I need to use print... Cheers, Seb -- 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.
