View previous topic :: View next topic |
Author |
Message |
horizontech
Joined: 09 Nov 2003 Posts: 13
|
LED on pin A4 ? |
Posted: Sat Apr 23, 2005 1:26 pm |
|
|
Hi !
I try to use pin A4 on pic 16f84a to drive a Led true a 330ohm resistor
Not work ?
I have try 4.7K pull up resistor the led stay at 25% on !!
I need some idea ?
Thanks
Alain Tanguay |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1907
|
|
Posted: Sat Apr 23, 2005 1:34 pm |
|
|
Not too sure about a 16F84A, but pin A4 on a lot of PICs is open drain. |
|
|
Mattr0
Joined: 27 Mar 2005 Posts: 30
|
|
Posted: Sat Apr 23, 2005 2:18 pm |
|
|
you are going to have todrive the LED through a transistor to get the full brightness
If you think about it you are taking the 4.7k + the 330 Ohm resistor to drive the LED. which would probably get you in the range of 1 mA The transistor takes a very small amount of current to turn it on to accomplish this task
the Dreaded a4 had me working for hours until I found that out a few years back |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Sat Apr 23, 2005 2:49 pm |
|
|
If you connect a LED through a 330 Ohm pull up resistor tied to +5V, you
should get full LED bright, doesn´t matter if the PIC pin is open collector or not.
One of the best characteristics of the PIC family is that they can
source/sink up to 25mA in every INP/OUT PIN.
Re-check your hardware and if posible swap the PIC.
Humberto |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Sun Apr 24, 2005 4:38 am |
|
|
Alain's first attempt. Not working because A4 is Open Collector:
Code: | ------- |\|
A4 ---| 330 |-----| |-----|
------- |/| |
|
-----
---
- |
My interpretation of Alain's second attempt:
Code: | +5V
|
---
|4|
|k|
|7|
---
|
|
| ------- |\|
A4 -----| 330 |-----| |-----|
------- |/| |
|
-----
---
- |
Now the led gets 1mA, not enough for standard leds.
How it should be done: Code: | +5V
|
|
------- |/| |
A4 ---| 330 |-----| |-----
------- |\| |
Note the reversal of the led. Also check the maximum current allowed for the led, in this example the 330 Ohm resistor at 5V will give a led current of 15mA. |
|
|
horizontech
Joined: 09 Nov 2003 Posts: 13
|
|
Posted: Sun Apr 24, 2005 11:40 am |
|
|
Thanks for you help !!!
Alain Tanguay |
|
|
Guest
|
|
Posted: Sun Apr 24, 2005 1:32 pm |
|
|
Can I add that although nearly all PIC pins can sink/source 25mA they can't do it all at the same time! There is a overall current limit for the device! |
|
|
|