PDA

View Full Version : Pin RA4 doesn't work



Melanie
- 15th July 2004, 12:03
Pin RA4 doesn't work
POT Command doesn't work on RA4
RCTIME Command doesn't work on RA4
See also thread I/O pin and MCLR
See also thread - Do I need that Resistor with my LCD?


Pin RA4 doesn't work

Oh yes it does. It works just fine on INPUT, but there is a difference with this pin with regard to OUTPUT on many PIC's... if you looked in the Datasheet it is 'open drain'.


In simple terms, what does this mean?

For OUTPUT on this pin, basically imagine an NPN transistor. It's EMITTER is connected to VSS, it's BASE is connected to the CPU, but it's COLLECTOR is connected just to the physical pin nowhere else.

This means that this pin can SINK current (example LED-k connected to this PIC pin, and LED-a via Resistor to Vdd). This works fine...

High PortPin ' LED is OFF
Low PortPin ' LED is ON

However, this pin CANNOT SOURCE current (example LED-a connected to PIC pin and LED-k via Resistor to Vss). This will NOT work.

Low PortPin ' LED is OFF
High PortPin ' LED is still OFF


Why doesn't the POT Command and RCTIME Command work?

These commands work by charging or discharging a Capacitor FIRST (which requires the Port to be switched to OUTPUT momentarily) and then timing the charge/discharge to give you a value. If you really must use these pins for those commands, then you will have to provide a pull-up Resistor (the actual value is very much dependant on your connected circuit and will probably be best determined by experimentation) and even then the results may be disappointing (or may not work at all).