18F2420 Analogue Channel Selection Query

Status
Not open for further replies.
Hi all,

Sorry if this is a dumb question but if I wish to use AN12 (RB0) and I set ADCON1 (PCFG3CFG0) = 0010 as shown below this doesn't preclude me from using the other pins which will be set as analogue channels as digital i/o?

**broken link removed**

Thanks in advance for any help.
 
My guess is no. If you only want one channel you must use AN0, but of course I could be wrong (in fact I usually am!) :-(
 
Pins that are configured as analogue work fine as digital outputs but always read zero when read. This can cause huge problems with RMW type instructions.

Mike.
 
You can use it it just not easy Is that not right Mike ?
You just cant do a (bcf or a bsf) but can set it High with portB or latb = b'11111110'
Or am I crazy Lol
This from the datasheet
 
bcf or bsf should be fine, since you don't care what RMW does with the remaining bits (it will read them as 0 and "write" them as 0).

It's RMW instructions like incf, decf, incfsz etc. that you'd have the real issues with.

Is there a particular reason you're using an12 instead of an0 for your analog input? You already laid out a PCB?

Unless you need to use the remaining pins as digital inputs, you should be able to use an12 by itself.
 
Last edited:

I want 7 dedicated pins on a port for a RTCC. I can modify my cct so that my RTC is on portC, my lcd on portB thus I can put my analogue input back on RA0 where it was before I connected the RTC chip.

Thanks.
 

Attachments

  • port.jpg
    388.9 KB · Views: 222
Rtc

Angry Badger,

Why don't you save yourself a lot of pins and use something like a PCF8535 on I2C?
Just a thought
 
Angry Badger,

Why don't you save yourself a lot of pins and use something like a PCF8535 on I2C?
Just a thought

gaspode42,

I'd not heard of a PCF8535 until you mentioned it. Just looked at the pdf. It looks a bit complicated for my level of understanding and I haven't dabbled with I2C yet. Something for the future.

Thanks for the advice though. Thanks Bert, kpatz, pommie.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…