Author Topic: PIC Input Pin voltage question  (Read 720 times)

0 Members and 1 Guest are viewing this topic.

Offline hobbyelectronicsTopic starter

  • Regular Contributor
  • *
  • Posts: 85
PIC Input Pin voltage question
« on: February 15, 2021, 03:11:15 pm »
Hi,

Just a simple question really.

If on a PIC MCU (PIC12F1572) one of the pins (RA1) is set to an input, with the pullups disabled but pulled up externally to 5V (VDD) via a 10K resistor, what voltage would you expect when measured at the pin and why?

Thank you

John

 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 13119
Re: PIC Input Pin voltage question
« Reply #1 on: February 15, 2021, 03:19:06 pm »
5V.   Input leakage current should be 1uA or less, so there shouldn't be more than 10mV across the resistor due to it.  However if you use a DMM with 10Meg input impedance it will drag the input down by approx another 5mV.  Both sources of error are negligible compared to the likely tolerance of the 5V supply.
 

Offline hobbyelectronicsTopic starter

  • Regular Contributor
  • *
  • Posts: 85
Re: PIC Input Pin voltage question
« Reply #2 on: February 15, 2021, 04:25:12 pm »
Ah, that's what I was expecting to see, 5V,  but I always measure 0.7V not matter what. All though when I read the value with code I get a high and if I pull the input to low I read a low as expected. but with a fluke meter I read 0.7V
Its as if another function or something on that pin is turned on or something, but can't seem to figure it out. If I apply the same thing to another input I measure the 5V as expected but on RA1 I measure 0.7V, with only that one 10K resistor tied up to 5V.

Uhmmm, back to the data sheet to double check every thing is configured as it should be.

Thanks
« Last Edit: February 15, 2021, 04:41:57 pm by hobbyelectronics »
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 13119
Re: PIC Input Pin voltage question
« Reply #3 on: February 15, 2021, 05:00:55 pm »
Try erasing the chip, which should leave it with external /MCLR enabled.  If at all possible, put the chip in a breadboard (so you know for sure nothing else is connected), connect Gnd and Vdd and tie /MCLR to Gnd to hold it in Reset.  If its a SMD part, check for anything on the board that may be pulling RA1 down, and once you are sure that nothing external is connected to except for the pullup, tie /MCLR low.

All I/Os should then be tri-state and a 10K pullup on RA1 should get you 5V on that pin.  If it doesn't the chip is damaged.

N.B. most Microchip programmers have pulldowns on some of their ICSP pins and also may heavily load ICSP pins when not powered by USB so make sure the programmer is physically disconnected!
 

Offline hobbyelectronicsTopic starter

  • Regular Contributor
  • *
  • Posts: 85
Re: PIC Input Pin voltage question
« Reply #4 on: February 15, 2021, 06:14:06 pm »
OK, all fixed. Thanks for your help.

I tried everything, but ended up changing the chip, which was an SMT device so had to pick up my hot air iron from work.
Replaced the chip and reprogrammed, everything now working as expected.

Must have had something very strange going on with just that pin, because it still read correctly with a high or low, but just always measured 0.7V
I reprogrammed the old one first but it made no difference.

Anyway, all good now

Thanks

 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 13119
Re: PIC Input Pin voltage question
« Reply #5 on: February 15, 2021, 08:11:43 pm »
I'd bet on an ESD zap causing it to leak to ground.  If you are in northern hemisphere winter at the moment, cold dry weather can result in very low humidity inside properly ventilated heated buildings so ESD damage becomes far more common.   
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf