PIC Microcontroller port pins
-
"RA4 doesn't behave right. It will pull down, but not up, even though I set
it as an output pin & am writing a '1' to it."
-
RA4 is an open drain (same as an open collector basically) output pin. You
need to either (a) use a different port pin, or (b) put a pull-up resistor
from that pin to Vdd (+5V typically), to make the pin pull up as default.
-
"When I set a port pin as an input, then ground & unground it with a
switch, it sometimes works & other times doesn't work."
-
You have a floating input; You want to
use a pull-up or a pull-down resistor, if you are driving this pin with an
open drain or a switch to Vcc or Ground, directly. {mention weak pull-ups?}
10k is a good value here.
-
Interested: