18F452 ADCON problem

Status
Not open for further replies.

brodin

New Member
I am using PORTE.0 as an analog input. I have configured the ADCON's like this:
ADCON0 = 171
ADCON1 = 176

The A/D conversion works great, but i cant usePORTE.1 as digital input at the same time.

In ADCON1 there is impossible to configure the AD one by one. I have to set all PORTA and PORTE to analog by setting bits 3-0 to 0000.

But then PORTE.1 doesn't work as a digital input, it just reads 0.

What can i do to get the other port working as digital?
 
I've never used any of the 18 series PIC's, but on the 16 series there are strict limitations on the analogue inputs - these are clearly explained in the datasheet, so presumably will be so in the 18 series datasheets. I suggest you read the datasheet, which will explain how to select analogue and digital inputs and the restrictions involved,
 
Setting ADCON1 = 185 or 10111001b enables inputs AN0-AN5 (includes PORTE.0) as analog input but frees up PORTE.1 & PORTE.2 to be used as digital I/O.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…