:: PIC PORTA, cant configure something... :: HELP

Status
Not open for further replies.

suby786

New Member
PIC16F877A

Hey dudes

ive become pretty proficient with PICs recently but this has thrown me,

I have two inputs that need to be DIGITALLY READ... i.e. either 0v or 5v, fine thats easy to do if u set TRISA to outputs and ADCON1 to 6h say... (ALL DIGITAL)

Now i ALSO want to configure 4 of the inputs to ANALOG... so if i go by the ADCON table, i can use 9h so AN6/7 are my digital inputs and 0-5 are my analog... BUT PORTA and TRISA are only 6bits wide... so i cant read AN6/7 as digital inputs where on page 128, it says D is DIGITAL I/O.

This is CONFUSING....

Cant i read these two pins in as DIGITAL?

HELPPP.... BTW i only want to use PORTA, all other ports are used
 
AN5-7 are actually Port E pins.
Because of your requirement to only use portA there is no setting that will allow 4 analog and 2 digital inputs on portA .
The closest to it would be 04h which gives 3 analog and 3 digital ports.
 
You are a legend mate..

THANK U SOOOO MUCH for ur prompt reply, i wasnt using PORTE, just PORTB/C/D... didnt realise it was PORTE... the digital I.O works, now need to test the ADC... thanxks anyway
 
suby786 said:
You are a legend mate..

THANK U SOOOO MUCH for ur prompt reply, i wasnt using PORTE, just PORTB/C/D... didnt realise it was PORTE... the digital I.O works, now need to test the ADC... thanxks anyway

Check my PIC analogue tutorial, it explains the setting and use of the ADC simpler than the datasheet.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…