How do you connect I/O pins like a switch
Karl Matlack
Posts: 5
Is it possible to connect say P0 and P1 together as a normally open switch and then have code that connects them?
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
You can connect a relay to an I/O pin (like a reed relay designed for a 5V signal) that will act like a simple normally open switch. Some of them can be driven directly from the I/O pin (if they require maybe 15ma or less coil current). You do need a diode connected backwards (cathode to +5V) across the relay coil to protect the I/O pin. Look at the What's a Microcontroller tutorial for an example.
There's also a device called an analog switch that can be driven from an I/O pin and provides a normally open connection between two pins. These have some resistance (maybe 100 ohms) in the closed connection and there are voltage limitations for any signal conducted (0-5V usually).
- Stephen
Here's a link to the datasheet: www.fairchildsemi.com/ds/H1/H11F1.pdf
-Phil
Post Edited (Phil Pilgrim (PhiPi)) : 6/22/2007 6:11:49 AM GMT
The easiest thing to use would be a reed relay like the 5V version here: www.jameco.com/Jameco/Products/ProdDS/138430.PDF. This one includes the protective diode. You simply connect the coil end with the anode of the diode to the I/O pin and the coil end with the cathode of the diode to +5V. A LOW statement closes the contact of the relay and an INPUT or HIGH statement lets the contact open. You connect the contacts across the button of the remote and it should work.