Internal Pullup Resistors


Senior Member
Just a quickie question, had a quick search & can't seem to find anything.

Does anybody know the value of the internal pullup resistors on M2 chips, and is is consistent across the same types ?.



Senior Member
My recollection is that the 'weak pullups' are defined as a current of around 250uA and not as a resistor value.

Thats 'typical' but could be lower or higher, so I would not rely on the value to be consistent.


Technical Support
Staff member
An 18M2 pullup is defined as typically 140uA @ 5V.

Which implies 5 / 0.00014 = approx 35K

However as an embedded silicon feature they can vary considerably between parts or between pin on the same part.


Senior Member

Yes, the data sheet of the "base" PIC device(s) does specify a "typical" current, but in practice (I'm mainly using 08 and 20M2s) each pull-up does appear to be a moderately "real" (linear) resistor (of about 35k), unlike many micros which actually do use a current-source configuration. However, the specified tolerance (over different devices and operating conditions) is enormous, corresponding to a range from about 16k up to 200k ohms!

This is quite relevant to one of my present projects, so I hope to show soon how a PICaxe can actually measure its own pullup resistor value, even "on the fly" whilst running another program with "normal" hardware.

Cheers, Alan.


Senior Member
My tests also show an internal pullup resistance of about 35K on M2 parts.

Here is a program I did a while back that calculates internal pullup resistance for any given I/O pin. Connect a 10K resistor from the I/O pin to ground. Then connect the I/O pin directly to the ADC pin (I used c.7). Towards the top of the program enter the value of your supply voltage in millivolts. 5 volts will be 5000, 4.5 volts will be 4500, etc. The supply must be greater than 4.2V.

(The calculations to not include the impedance of the ADC input and may be very slightly off)

I have tested 2 20M2s and one shows about 36.5K on all Pins while the other showed about 37.5K
A 08M2 showed ~38.5K on C.1,C,2,C,3

It is important to understand that the "internal pullup" is a current source and not a physical resistor, and that the current source is not constant. Therefore the "resistance" shown is theoretical and is the "effective resistance?" when the current is applied to a 10K load.

It seems to me that if you are looking for minimum power consumption that a 100K external pull-up might be preferred. If looking for minimum parts count then an internal pull-up might be preferred.

'Testing Resistance of Internal Pullups

#Picaxe 20M2
Setfreq M4
Pause 100

'Supply voltage must be >= 4.2 volts 
'Place a 10K resistor from I/0 pin to ground
'Connect I/0 pin under test to C.7

'Change value below to match your supply voltage 

 symbol supply = 5000 '// In millivolts    


symbol adc_val    = w1
symbol millivolts = w2
symbol current    = w3
symbol resistance = w4
symbol supply2    = w5

Pullup  %0111111111111111 
pause 1000

fvrsetup fvr4096
adcconfig %011
supply2 = supply * 10                'Scale for calculations

   readadc10 c.7,adc_val           'Voltage drop across 10K resistor
   millivolts = adc_val * 4        'Scale to millivolts 
   current = millivolts / 10       'Current   
   resistance = supply2 / current   'Total resistance  
   resistance = resistance - 100   'Subtract 10k resistor
   bintoascii resistance,b12,b12,b13,b14,b15
   sertxd ("Current = ",#current," Microamps",cr,lf)
   sertxd ("Internal Pullup Resistance ", b12,b13,b14,".",b15,"K",cr,lf)
   sertxd (cr,lf)  
   pause 2000


Last edited:


Senior Member

The supply rail could be automatically measured with a CALIBADC10. But it's not even necessary to know the supply voltage if the A-D converter uses the supply rail as reference.

I don't have any PICaxe hardware accessible at the moment but the following should work (for pin c.1):

;  To measure the Weak Pullup Resistance: Connect a 10k resistor from c.1 to Ground.
PULLUP 2				; Or $200 for 20M2 
READADC10 c.1,w1
w1 = 1024 * 50  / w1 - 50			; Resistance (units = 200 ohms for better accuracy)
b0 = w1 / 5					; Integer result
b1 = w1 // 5 * 2				; Fractional part
SERTXD("Weak Pullup Resistance= ",#b0,".",#b1," kohms",cr, lf)
PAUSE 2000
But the "trick" is to measure it without adding any extra components. ;)

Cheers, Alan.


Senior Member
Ok, so may be about 35k.

Thanks for all the replies.

I was looking for minimal component count, may give it a go, just a CDS sensor to 0v and see what happens.



Senior Member

Yours seems to be off by about 5K compared to my example. Yours reads 32K. Mine reads 37.5K

However, using the code I provided, when I use the ADC and Pullup on the same pin (c.2) like you did, the result is also 32K.

It would seem that having the ADC and Pullup on the same pin skews the result by ~5K ohms.


Technical Support
Staff member
When you use readadc command the 'input' part of the PIC internal circuit is automatically disconnected, so it may well be this automatic 'adcconfig' disconnection on that pin that makes the difference.