Weak Pull-up
by CatsEyes
You can use an external resistor from a PIC pin up to the 5 volt rail to "pull up" the pin, but there is a more sophisticated way to do it that saves parts.
Note: if you want to test if it's working, the internal pull-up resistor is small enough that it will weakly light an LED on the pin. It is suggested you put a small resistor in series in case you accidentally switched the pin to an output. For example, see the diagram.

If it glows brightly, you're outputting a "1" !!!
|
|
MOVLW |
B'0xxxxxxx', W |
; GPIO Pull-ups enabled |
|
|
MOVWF |
OPTION_REG |
|
|
|
BSF |
STATUS, RP0 |
; Bank 1 |
|
|
MOVLW |
B'00000010', W |
; Pull-up on GP1 enabled |
|
|
MOVWF |
WPU |
|
|
|
BCF |
STATUS, RP0 |
; Bank 0 |