PDA

View Full Version : portA.4 on a 16f628A?



kenpo
- 25th March 2005, 07:32
how do I get portA.4 to work on a 16f628A?

High 12
and HIGH portA.4 both will not turn an LED on...

and I am using: CMCON = 7 to turn off the comparators and use A as I/O.

what am I missing?

thanks!

Melanie
- 25th March 2005, 10:07
PortA.4 requires a pull-up to +Vdd. It's the ONLY pin on this PIC that is open drain (open collector). This means it CANNOT SOURCE any current, but it CAN SINK current...

Try this... Connect a Resistor (any value between 220R and 390R) between +Vdd and the Anode of your LED (Long Leg). Connect the Kathode (short leg) of your LED to PortA.4.

CMCON=7
Loop:
High PortA.4 ' LED will be OFF
Pause 500
Low PortA.4 ' LED will be ON
Pause 500
Goto Loop

Read I/O Ports section in the PIC's DATASHEET.

kenpo
- 25th March 2005, 18:25
thanks! I'm sorta consused why this one pin is so different.. but I shall work around it I guess.

thanks for the info! appreciated!