Weak pullups provide a method within many microcontrollers, such as the Atmel AVR and Microchip PIC families, to support internal/selectable
pull-ups for convenience and reduced parts count.
If you require weak pullups, these internal pullups can provide a simple solution. For example, you can use them to ground input pins with a switch closure — with the pullup enabled, the pin is held in a high state until the input line pulls it to ground. Be aware of possible EMI interference, and be sure to use a debounce routine.
If you need your weak pullups to precisely control current (rare for most microcontroller applications), consider 10K resistors instead (5V/10K = 500uA). Why? Because the microcontroller datasheet gives no resistance value for the weak pullups — they are not weak pull-resistors, but weak pullups consisting of what appear to be high-resistance channel pFETs. Their channel resistance varies with temperature and between parts, and is not easy to characterise precisely.
The datasheet gives a current range for the internal pullups of 50-400uA (at 5V).
Ports can have an individually controlled weak internal pullup. When set, each bit of the appropriate Microchip PIC register enables the corresponding pin’s pullup. There is a master bit within a specific register that enables pullups on all pins that also have their corresponding weak-pull bit set. Also, when set, there is a weak-pull register bit that disables all weak pullups.
The weak pullup is automatically turned off when the port pin is configured as an output. The pullups are disabled on a power-on reset.
Each specific microcontroller has different registers/bits for this functionality.
You should review the datasheet for the method used on a specific microcontroller.
The following code demonstrates how to set the weak pullups available on port B of an 18F25K20.
Example:
'A program to show the use of weak pullups on portb.
'Set chip model
#chip 18F25k20,16 'at 16 MHz
#config MCLR = Off
Set RBPU = 0 'enabling Port B pullups in general.
SET WPUB1 = 1 'portb.1 pulled up ' <<< the instruction that enables the weak pullup on a specific pin
Set WPUB2 = 1 'portb.2
Set WPUB3 = 1 'portb.3
Set WPUB4 = 1 'portb.4
Dir Portb in
Dir Portc out
do
portc.1 = portb.1 'in pin 22, out pin 12
portc.2 = portb.2 'in pin 23, out pin 13
portc.3 = portb.3 'in pin 24, out pin 14
portc.4 = portb.4 'in pin 25, out pin 15
loop 'jump back to the start of the program
'main line ends here
endKey line: SET WPUB1 = 1 — enables the individual weak pullup on PORTB.1; RBPU = 0 must also be cleared first to enable pullups on Port B generally, since the master enable bit is active-low on this device
family.
See also the I2C Slave Hardware example for a similar use on a 16F microcontroller.
See Also:

