CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

low current (1 ma) LED is draining 25ma

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Nick
Guest







low current (1 ma) LED is draining 25ma
PostPosted: Wed Sep 15, 2004 1:09 pm     Reply with quote

I hooked the LED directly to the pic port and the ground. Did I do something wrong? should there be a resistor inbetween the LED and ground? When is it drawing so much current?

Nick
alexbilo



Joined: 01 Jun 2004
Posts: 39
Location: Trois-Rivières

View user's profile Send private message

PostPosted: Wed Sep 15, 2004 1:17 pm     Reply with quote

Hi,

You should always use a resistor to limit the LED current. Omitting this resistor can lead the destruction of the pin and/or the LED.

Most of the time 220 ohms is a good resistor value, but you can calculate it more precisely knowing the LED voltage and the current that you want.

Good luck,
_________________
Alex
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Wed Sep 15, 2004 1:30 pm     Reply with quote

First you need to know the PIC pin voltage at the current you intend to draw. You can get this from the PIC datasheet, but for 1mA and a 5V supply we can guess it will be 4.9V
Next you need the LED voltage at the intended current. This comes from the LED datasheet. For now we will guess 1.8V.
The resistor will drop the remaining voltage: 4.9-1.8 = 3.1V
Ohms law gives us R=E/I = 3.1/.001 = 3100 Ohms
3300 Ohms would give 3.1/3300 = .9mA
2700 Ohms would give 3.1/2700 = 1.1mA
so any value between 2.7K and 3.3K will give very close to 1mA. Even 1K will give only 3.1mA which should be fine unless you are concerned over battery life.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Nick
Guest







PostPosted: Thu Sep 16, 2004 10:35 am     Reply with quote

Thank you for that detail! thats exactly what I needed to know to solve this problem

Nick
Guest








PostPosted: Thu Sep 16, 2004 1:26 pm     Reply with quote

Could I use this to limit current the powering the pic from my 4.5v source?

Nick
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Thu Sep 16, 2004 2:17 pm     Reply with quote

Quote:
Could I use this to limit current the powering the pic from my 4.5v source?


I wouldn't do that! The voltage would not be very stable. The more current the pic draws, the lower the voltage would get.
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Thu Sep 16, 2004 4:55 pm     Reply with quote

Never try to limit the current that is supplying VCC to an IC. IC's like to eat whatever power they need. If you do try it the part will most likely act erratic. You can limit the current that is flowing in or out of each individual pin but never VCC or GND. Each transistor junction, inside the part, needs to be biased correctly for the part to work properly and if you start limiting the current then all of those biasing voltages are not ballanced anymore. Try using parts that are designed to be low power parts instead.

Ronald
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group