PDA

View Full Version : High current consumption on input Port A



crhomberg
- 21st November 2007, 12:16
High all,

Can anyone tell me why Port A and Port E would draw high current when in digital mode connected to +5V to read a DIP switch?

I have ADCON1 = 7

and have the 1st 6 bits connected to A0 to A5 and the last 2 bits to E0 and E1.

I am reading currents of 200mA being drawn by the 16F877A ( frying!)

I read the datasheet of PortA and it seems that when in digital all is just TTL inputs.

What have I done wrong?

Regards

Chris

Bruce
- 21st November 2007, 13:02
Are you sure you have all pins connected to +5V configured as inputs?

crhomberg
- 21st November 2007, 13:10
Yes, I think I have
ADCON1 is set as 7, trisA=1 and TrisE0=1, trisE1=1 and trisE2=1

Regards


Chris

Bruce
- 21st November 2007, 13:15
If TRISA = 1 you only have PORTA.0 configured as an input. If you're using A0 to A5 then
you'll need TRISA = %00111111.

crhomberg
- 21st November 2007, 13:27
Hi Bruce,

How stupid can I get, I am so used to setting a whole port to outputs with trisA=0 that I forgot that BIN 11111111 = DEC 255.

Excuse me for wasting your time!

Regards

Chris