Exact match. Not showing close matches.
PICList
Thread
'[OT] Controlling LED brightness'
2000\04\18@122437
by
John Pearson
I want to control the brightness of an LED from one pic output pin. The LED
will be about one meter from the pic. Would the output pin be able to
handle this by pulsing the LED?
If pulsing the LED through one meter of wire is not acceptable, is there a
hardware method to control the current - a frequency to current converter?
Thanks
John
2000\04\18@132715
by
David Duley
|
On Tue, 18 Apr 2000 09:14:43 -0700, you wrote:
>I want to control the brightness of an LED from one pic output pin. The LED
>will be about one meter from the pic. Would the output pin be able to
>handle this by pulsing the LED?
>
>If pulsing the LED through one meter of wire is not acceptable, is there a
>hardware method to control the current - a frequency to current converter?
>
>Thanks
>John
Hi John
This should do just fine. I do this with DC motors with very good
results. I use a periodic interrupt routine from the RTC set to the
256 times the base PWM frequency. I allocate a byte for flags and a
byte for the motor speed (Brightness in your case) 255 (FF) being
full on to 00 being full off. The interrupt routine watches the flag
byte and determines if the LED should be lit. If it should be lit
then read the PWM value byte and turn on the LED for that many
interrupt cycles and off for the remainder. This method is very clean
in terms of what your main routine needs to worry about. When your
main routine wants to light the LED all it has to do is load the
brightness value into the variable and set the appropriate flag in the
FLAGS variable. when you want the LED to go off just clear the FLAGS
variable. You might need to experiment with the base PWM frequency a
bit to get the best results. Probably 1KHZ or so.
If you need more let me know.
Best regards
Dave Duley
2000\04\18@141328
by
Giles
One way, make a little RC circuit going to the gate of a transistor that
drives the LED. That way it will not be blinking, and you can strobe it to
increase the RC current to the gate. On longer will turn on the gate better.
Also you can drive more power than the port is capable of (although the port
has plenty of power for a single normal LED)
Best regards,
Giles
{Original Message removed}
More... (looser matching)
- Last day of these posts
- In 2000
, 2001 only
- Today
- New search...