PIC Microcontroller Port Pins

See:

"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. Either (a) Use a pull-up resistor from the port pin to Vcc, and use a switch to drive that port pin to GND, or (b) Use a pull-down resistor from the port pin to GND, and use a switch to drive that pin to Vcc.

10k is a good value here.

{Should I mention weak pull-ups?}

"When setting a port A pin as an analog output, any read/modify/write instruction will result in the analog voltage being set to zero"
Bob Ammerman [RAMMERMAN at PRODIGY.NET] of RAm Systems says:
Now that gets me to thinking: Here is a neat trick to get a 'push-pull' output from two PORT A pins:

1: define them as analog (ADCON1)
2: TRIS them as outputs.

Now, when you BSF either of them the other will automatically be cleared.

(Huh ? I thought PICs didn't have analog outputs?)
"It is possible to miss interrupts on some port B pins if you read or write to other pins on the same port... on some PICs, look for the "interrupt on change" warning in the datasheet for the device you are using."
Bob Ammerman [RAMMERMAN at PRODIGY.NET] of RAm Systems says:
Any time you read the port you will reset the 'current value' condition for the pins.

So, if you take an interrupt and read the port to see what changed it will reset the interrupt condition. This is good.

Where you get in trouble is if _another_ change in the input occurs just at the moment you are reading the port. In this case you can miss it.

But, if you know for certain that a second change on any of the inputs cannot occur before you get into your interrupt handler and read the status you will be ok.

see also:

Interested:

Comments:

Questions: