please dont rip this site

Interfacing LEDs to PIC microcontrolers


I'm trying to use one I/O for both input and output (RA1 on a 16C84). Software - Every [so often] the pin is changed to an output and set high to drive an LED for about [a while]....then turned off and changed back to an input. Between the LED blinks I poll the input to check whether it's HI. To debounce, the input must be HI once and again 20msec later. I've got the weak pull-ups disabled.

Hardware - The pin has a 470 ohm resistor and (Smurf-) blue LED to ground. Also a pushbutton switch and 10k resistor to V+.

What should happen:

If pushbutton not pressed - LED should just blink. If pushbutton is pressed - start other routine.

What does happen:

Other routine starts by itself. Even if 10k resistor is pulled out of the circuit and circuit left open (so pushbutton is not malfunctioning). Also, never noticed the problem occurring during the night - always during the day. I can trigger it with a flashlight!

Why:

The [input pin] is floating - worse, the LED [is] generating a (very very tiny) current from light. Try putting a pull down resistor (100K) from the pin to ground, or across the LED.

I use the inverse (LED to vcc, push button low) of your circuit (with the extra resistor) on my graphic LCD checker:- http://ourworld.compuserve.com/homepages/steve_lawther/t6963tst.gif with no problems.

PIC countdown timer

PIC 16F84A elapsed time counter on 4, 7 segment LED's

Rotate some bits without affecting others

Fashing LED program for 16f877

Driving multiple bicolor LEDs in a matrix from and embedded controller

Using lookup tables to convert numbers to seven segment LED display patterns

Driving 8 or 9 7 segment displays with 8 or 9 io pins (and no extra circuitry)

General LED interfaceing

From the CHEAPIC tutorial:

See also:

PICList post "How to matrix bicolor LEDs?"


file: /techref/io/led/pic.htm, 4KB, , updated: 2006/10/19 09:29, local time: 2008/11/21 13:56, owner: pr-ooo-13G,
TOP NEW HELP FIND: 
38.103.63.57:LOG IN
©2008 PLEASE DON'T RIP! DO: LINK / DIGG! / MAKE!

 ©2008 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it!
<A HREF="http://www.massmind.org/techref/io/led/pic.htm"> Interfacing LEDs to PIC microcontrolers</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be reviewed) Just type in the box and press the Post button. (HTML welcomed!): A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Did you find what you needed?

 

Welcome to massmind.org!

  'What can I do?' - SiCKO

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .