Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

8 Leds on portb, PIC16F84A

Status
Not open for further replies.

zanor

Member level 4
Joined
Feb 17, 2006
Messages
79
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Norway
Activity points
2,039
As a start I want to connect 8 led's(3V, 20mA) to portb.
But from what I read in the datasheet, maximun current out from portb is 100mA.

So how do I do this?

And since output voltage is ~5V (right?) and the led is 3V, 20mA.

Will a 100Ohm resistance work for voltage drop before the led?


BTW: How do I post real links on this forum?
 

the 3V is the voltage drop across the LED.... 20mA is the max current allowed...

so the R = (5-3)/20m

the max current on portb wont burn ur LED... it depend on load..

sp
 

Hello,

But from what I read in the datasheet, maximun current out from portb is 100mA.

So how do I do this?

This is indeed correct. The problem isn't that you'll burn out your LED's, its that you 'may' burn out portB on your PIC. I have done this in the past with the 16F84A.

What you would need to do is choose a resistor value that means, each LED will only draw 1/8th of the maximum current allowed through portB. In this case...100/8mA

Assuming you're powering your PIC with 5v, that means that the voltage across the resisotr should be about 2v. (double check the V-drop across the LED though, in a test circuit, resistor -> LED).

So, using the ever-useful V=IR. We want to know R. Because portb is rated at 100mA, the maximum current for each LED (assuming you want them all the same brightness) is 100/8 = 12.5mA = 0.0125A. We now have 'I' and V'.

V=IR. Therefore... R=V/I = 2/0.0125 = 160 ohms. One resistor for each LED.

This relies on the fact that your LED voltage drop is about 3v.

If you want each LED to have 20mA. Then you will need to drive each LED with a transistor...you can get driver chips from most distributors.

regards,

BuriedCode.
 

    zanor

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top