You interface a digital device, your I/O must follow this requirement.
ADCON0 refer to the analog to digital converter, not a bad idea to do so. Look a bit later in the datasheet (ADCON1) and you'll discover to how enable/disable it on specific I/O.
If my memory serves me well, i think you can also disable PORTB analog in the config fuses as well.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
If you plan to use a pin that has A/D on it for digital I/O, then you for sure want to disable
the A/D feature for that pin. Otherwise it reads as 0.
ADCON1 = 15 turns off all A/D. See the data sheet REGISTER 19-2: ADCON1: A/D CONTROL
REGISTER 1 section.
Where you see a D in the A/D Port Configuration Control Bits chart, this indicates Digital for
that pin. Where you see an A, this indicates the pin is configured for Analog.
Another option is to use PBADEN config bit. If PBADEN = 0 then AN0-AN7 are analog by default at POR
(power on reset). AN8 to AN12 are digital. If PBADEN = 1 then PCFG 2 to 0 = 1, which means AN0 to AN12
pins are analog
Look at the chart in your data sheet. If ADCON1 = 0 then all pins with analog capabilities are
Analog. If ADCON1 = 15 what are they?
Last edited by Bruce; - 19th November 2007 at 22:32.
They are ALL digital, right?![]()
Yeah - I was just reading about ADCON1 on the datasheet and seems like I should try again with ADCON1=15 at the beginning of my program. That will turn RB4 (which is also AN11) into a digital port (along with all the other A/Ds). My fingers are itching to try this out, but alas I don't have my programmer with me. Can't wait to try it out when I go home. Man, this stuff is addicting!
Thanks Bruce!
Last edited by presario1425; - 19th November 2007 at 22:43.
You're 100% correct. Easy stuff isn't it.?They are ALL digital, right?
It really is..;o}Man, this stuff is addicting!
Just remember, the data sheet is all you really need beyond the PBP manual. Lookup the
value you need to place in a peripheral register to configure it to work the way you want
it to, and BINGO you're off to the races.
It really is that simple.
Bookmarks