Weak Pullups

Weak pullups provide a method to within many microcontrollers such as the Atmel Atmel AVR and Microchip PIC microcontrollers to support internal/selectable pull-ups for convenience and reduced parts count.

If you require Weak pullups these internal pull-ups can provide a simple solution.

If you need your weak pull-ups to exactly control current (rare for most microcontroller applications), then you should consider 10k resistors (5V/10K = 500uA) Why? If you review in the microcontroller data sheet, there is no resistance given for the weak pull-ups. That is because they are not weak pull-resistors they are weak pull-up consisting of what appear to be high- resistance channel pFETs. Their channel resistance will vary with temperature and between parts; not easy to characterize.

The data sheet gives a current range for the internals as 50-400uA (at 5V).

PORTs can have an individually controlled weak internal pull-up. When set, each bit of the appropriate Microchip PIC register enables the corresponding pin pull-up. There is a master bit within a specific register bit that enables pull- ups on all pins which also have their corresponding weak pull bit set. Also when set, there is a weak pull register bit to disable all weak pull-ups.

The weak pull-up is automatically turned off when the port pin is configured as an output. The pull-ups 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 for a specific microcontroller.

The following code demonstrates how to set the weak pull-ups available on port B of an 18F25K20.


    'A program to show the use of weak pulled-ups on portb.
    'Set chip model
    #chip 18F25k20,16 'at 16 MHz
    'Switch Low-Volt-Programming:
    #config LVP = Off
    #config MCLR = Off

    Set RBPU = 0 'enabling Port B pullups in general.
    SET WPUB1 = 1 'portb.1 pulled up
    Set WPUB2 = 1 'portb.2
    Set WPUB3 = 1 'portb.3
    Set WPUB4 = 1 'portb.4

    Dir Portb in
    Dir Portc out

        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

Also, see I2C Slave Hardware for an example using a 16F microcontroller.