2010/10/4 Joep Suijs <[email protected]> > > 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... > > So why is this different for 16f876a? >
Because 16f876 has less analogs than 16f877 (5 vs. 8). Now how does it impact bits configuration ? The algorithm goes like this (see tools/adc/adc_channels.jal.tmpl): - for each PICs found in a datasheet, groups them using the number of available analog pins. For datasheet 39582, we have 4 PICs, grouped by 2. One group has 5 analogs (16F876A, 16F873A), another has 8 analogs (16F877A, 16F874A). See line ~160 in tmpl file, there's a comment, unfinished though :) - now, for each group, we consider the table declaring the different bit combinations (page 128). This can be found in pinmap.py in a more programmatic fashion. The "problem" is this is a full representation of the table (all columns, that is, all analog pins). - so a first step is to "prune" this table to match the number of available analog pins. For our first group with 5 analogs, it's just as if we've removed the first three column (AN7, AN6, AN5). Ignoring these cols and re-computing again the number of configured analogs (5/0, 6/1, ...), you now understand why there are multiple combination for 5 analogs in our first group. - for the second group, all analog pins found in this table are found in the PICs (8). so the table isn't pruned, all combination are kept. I hope this explains better why 16f876 and 16f877 aren't processed the same way. As I said, there are many information to be compiled/considered when generating ADC libs, this can make it tricky. I tried to comment as much as I can (in tmpl mostly - the right place), provided I finish my sentences :) 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.
