Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

25mA output from PIC16F628

Status
Not open for further replies.

aljamri

Member
Hi everybody;

During one of my first expermints on PIC16F628 using Nigel's Tutorials. I used RED 7-sigment LED connected directly to the PIC. i noticed that the chip is warm and the 7805 regulator is hot, i measured the following:

7805 input = 9vdc Stable
7805 output = 5vdc Stable
PIC output PORTB= 1.6 vdc ( each of all the 8 outputs )
Current flowing to each Segment = 24 mA ( each of all the 8 outputs )

Is that normal or not? I have run the PIC for long time with no more heat but could any thing make butter ?

Thanks
 
Hi,
Do you have any current limiting resistor for the 7-segment display?
Besides, the output voltage of the PIC is supposed to be Vdd - 0.7 V (according to the datasheet). Was your 7-segment display burned out?
 
You should check the electrical specifications section of the Data Sheet. While individual Port B pins can source or sink 25 ma, I believe there's a specification that says you shouldn't source or sink more than 100 ma for the whole port. I may be mistaken so you should really check the Data Sheet.

Good luck. Have fun. Mike
 
A back of the envelope calculation-

5V supply - 1.6V (Vfwd of a typical red LED, hence that's why you saw 1.6V) = 3.4V drop by PIC
current=0.024A
x 8 segments = .65W worst case (all on). This may feel a bit warm. Thus this is to be expected.

One time I tried to power four 7-seg LEDs and 16F628 with a single 78L05. That 78L05 got _really_ hot, hot enough to cause burns malfunction :eek: Source voltage was near 14V so it had to drop quite a bit of power despite needing less than 100mA of power to run the PIC and LEDs.

If you're using a regular 7805 and a 9V, I don't know why it gets really hot, if it's hot enough to burn something doesn't seem right. More back of the envelope calculations indicate that since 9V-5V=4V dropped by the regulator, and if the PIC used negligible power, 24mA*8 * 4V is a bit more than 3/4 W so it should be getting warmer than the PIC. You should put a small heat sink on the 7805 but if it's not too hot to put your fingers on it, it probably doesn't need it.

24mA is actually quite a bit of current through a LED and will reduce its lifetime. You may want to look into reducing current to 15mA or so, or pulse the output via software so the average current is less. Since my 4-displays were multiplexed, the average current was well less than 10mA per LED segment.
 
No, No!

:eek:
bananasiong said:
Hi,
Do you have any current limiting resistor for the 7-segment display?

No, where/howmuch resistor to put if i am using Common Cathode unit. ( Flipped all Nigel's tutorial Port outputs 041 & 140 since it is made for Common Anode )

bananasiong said:
Hi,
Besides, the output voltage of the PIC is supposed to be Vdd - 0.7 V (according to the datasheet). Was your 7-segment display burned out?

No it give a brighter than usual but not burn and i run this circuit for quite long time.
 
24 X 8 = 192

Mike said:
While individual Port B pins can source or sink 25 ma, I believe there's a specification that says you shouldn't source or sink more than 100 ma for the whole port.

the whole port ? do you mean the 8-pins ?! oh my god this means i double overload it. Is that IC that much rigid?
 
boxer4 said:
.....If you're using a regular 7805 and a 9V, I don't know why it gets really hot, if it's hot enough to burn something doesn't seem right.

It is hot but not enough to burn.

boxer4 said:
24mA is actually quite a bit of current through a LED and will reduce its lifetime. You may want to look into reducing current to 15mA or so,

Is it possible to use a common resistor at the CC or do i have to connect a resistor for every segments?

boxer4 said:
or pulse the output via software so the average current is less.

How?
:)
 
Looking at microchip doc 40300b (16F62x) section 17, it says:
maximum power dissipation: 800mW
maximum sink or source by single pin: 25mA
maximum portA and portB together, source or sink: 200mA
So it looks like it's OK run it that hot.

You'll need to add a resistor for every segment to do it the hardware method, or via software simply turn off all the LEDs once in a while, really fast - usually at least 120Hz or so so you don't notice any flickering. If you have a loop that lights the LEDs it's a bit easier, else you could set a timer to update the LEDs.
 
Last edited:
boxer4 said:
Looking at microchip doc 40300b (16F62x) section 17, it says:
maximum power dissipation: 800mW
maximum sink or source by single pin: 25mA
maximum portA and portB together, source or sink: 200mA
So it looks like it's OK run it that hot.
Thanks for your tiem and efort

boxer4 said:
You'll need to add a resistor for every segment to do it the hardware method, or via software simply turn off all the LEDs once in a while, really fast - usually at least 120Hz or so so you don't notice any flickering. If you have a loop that lights the LEDs it's a bit easier, else you could set a timer to update the LEDs.

Is this simillar to multiplixing two 7-segments reading using two transistors? ( again from Nigel's Tutorial )
 
aljamri said:
During one of my first expermints on PIC16F628 using Nigel's Tutorials. I used RED 7-sigment LED connected directly to the PIC. i noticed that the chip is warm and the 7805 regulator is hot, i measured the following:

As you've seen my tutorials, why not follow them and add the current limiting resistors like I did?. You don't want to use LED's without resistors!.
 
I've never read Nijel's tutorials :rolleyes: but yes, you can get away with not adding them if you write your software a certain way.

I'll just use my project as basis. Since each pin supplies a max of 25mA, if there was only one LED, a max of 25mA would go through. However, I have four LED displays multiplexed. That pin can still only drive 25mA, but I'm rapidly switching each of the four displays on and off, and only one of the four displays is on at any given time. So the total, pulse width modulated current would be 1/4 of the full 25mA, dropping current down to around 6mA average. Note they are still 25 mA pulses, just that it's on 1/4 the time.

During the time the LED is off, which is 3/4 of the time, the LED can cool down from dissipating all that 25mA*1.6V worth of power, and the LED once again lasts as long as if it were using a low current. This way I have no resistors at all, just PIC pin -> LED -> Digit Driver transistor -> GND. I ended up using CC devices but as an afterthought I probably should have designed it CA and used a pnp digit driver.

Of course I do lose brightness due to the limited average current... but it's allright. I wouldn't use any more than 4 with a PIC in this method since I'm already cutting it a bit close, really need high brightness LEDs due to the severely limited current.

(Poor 16F628A... used every single pin on that device... 2 power, 7 for LED segment, 4 for LED digit, 2 for input/output, and 1 for reset... forced to use the internal oscillator...)
 
Your system is pulling about 200 mA (8 * 24mA). That means your Vreg is dissipating .2*4 Watts (800 mW). assuming your 7805 is in a TO220 package (theta of 60 C/W) then you should be seeing around a 48C rise over ambient. Say ambient is 25C then you are probably seeing around 73C (~160F). Hot to the touch.
 
The outputs of a PIC are the same Mosfets used in 74HC high speed Cmos logic ICs. They can supply 60mA just before they burn out. Maybe the current-measuring meter reduced the measured current.

The max allowed output current is 25mA. The IC doesn't limit the current to 25mA, your circuit must limit the current.
 
It's really a good practice putting current limiting resistor with LED. I've twice burned out the PIC without using any current limiting resistor for just driving a single LED.
 
Nigel Goodwin said:
As you've seen my tutorials, why not follow them and add the current limiting resistors like I did?. You don't want to use LED's without resistors!.

Sorry Nigel, I concentrate on the multiplixing idea using the transistors and did not noticed the 150:eek:hm: resistors :eek: :eek: :eek:
 
philba said:
Your system is pulling about 200 mA (8 * 24mA). That means your Vreg is dissipating .2*4 Watts (800 mW). assuming your 7805 is in a TO220 package (theta of 60 C/W) then you should be seeing around a 48C rise over ambient. Say ambient is 25C then you are probably seeing around 73C (~160F). Hot to the touch.

I reduced the 7805 input voltage up to 7 volts ( using power supply ) and the heat was a bit lower, that i think has something related with the extra input voltage. so is possible to use a resistor in series with the 7805 Reg input if i want to use 9v batt as supply instead?
 
aljamri said:
I reduced the 7805 input voltage up to 7 volts ( using power supply ) and the heat was a bit lower, that i think has something related with the extra input voltage. so is possible to use a resistor in series with the 7805 Reg input if i want to use 9v batt as supply instead?
Nothing to do with the input voltage, as long as it is not lower than the minimum input voltage and not more than the maximum input voltage.
A resistor in series with the voltage regulator is not a good idea. Just construct accordingly to Nigel's tutorial, use NPN if you're using common cathode and remember the base resistors as well.
 
In this case, I wouldn't use a resistor as the regulator will go into dropout when the battery runs down.

However when the input voltage is always significantly higher than the output a series resistor is often a good idea, for example if you want to run an LM7805 at 1A from a 24V supply a series resistor is a good way of reducing dissipation in the regulator.
 
boxer4 said:
Of course I do lose brightness due to the limited average current... but it's allright. I wouldn't use any more than 4 with a PIC in this method since I'm already cutting it a bit close, really need high brightness LEDs due to the severely limited current.

(Poor 16F628A... used every single pin on that device... 2 power, 7 for LED segment, 4 for LED digit, 2 for input/outpult, and 1 for reset... forced to use the internal oscillator...)
If you're not using digit driver transistors then you're probably not even getting the full 25-ma 'peak' current from the segment driver lines when more than one segment is lighted because your digit driver line can only source or sink 25-ma which must be divided between the lighted segment lines. You may notice uneven brightness, that is, a digit with 4 or 5 segments lighted may appear slightly dimmer than another digit that has only 2 segments lighted.

And if you're directly driving the LED segments (not using segment driver transistors) then you could get the same performance with less I/O pins using N(N-1) multiplexing, also known as Charlieplexing.

**broken link removed**


As you suggested, it's difficult to overcome the low brightness/low average current problem when directly driving LED segments without driver transistors. Using low current/high brightness LEDs helps, as does using higher duty cycles (lower number of digits). And you definately want to use digit driver (column driver) transistors. I've also discovered you get better brightness when sinking current to cathode segments (CA displays) rather than sourcing current to anode segments (CC displays) and I suspect there's much less of a voltage drop on the PIC pin when it's sinking current.
 
Last edited:
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top