PDA

View Full Version : Input / output using same pin



leonel
- 4th March 2007, 20:05
I'm thinking to use the same PIC I/O to drive a led and to be an input from a switch, this is being an input/output just by changing TRIS. It's possible isnīt it? I'm using the circuit attatched

HenrikOlsson
- 4th March 2007, 21:11
Hi,
Yes that would work. The drawback is that the LED will be ON while you push the button.

/Henrik Olsson.

Melanie
- 4th March 2007, 21:19
You don't actually need R1 as R2 via the LED will pull the pin high during the input mode, and all it will do is add extra unnescessary load to the I/O pin during output mode..