For LEDs you should certainly be able to use software-based PWM with good results. A PWM frequency of 100 Hz should be plenty. Bob Ammerman RAm Systems ----- Original Message ----- From: "Magnus von Rosen" To: Sent: Saturday, September 14, 2002 7:10 AM Subject: SV: [EE] How to fade a LED? Hello all, Thanks for the many replies! I should have described the project further. :) I usually try to cut down as much as possible to make the mail easier to read. The application contains 4 LEDs (3 mm, 20 mA, 2 yellow, 1 red and 1 white) which need to be turned on and off with the cycle Fade on, 300-500ms On 700 ms Fade off 300-500 ms In other words, I can't use the PWM? That only works on one pin at a time, right? What I was really after was any experience on how to balance the on/off periods during a fade. Should I keep the LED on more than off? Off more than on? What looks best? :) I am using both C and assembly. Trying to convert to C to evaluate it's effectiveness. :) Thanks again, Regards Magnus, Sweden -----Ursprungligt meddelande----- Fren: pic microcontroller discussion list [mailto:PICLIST@mitvma.mit.edu] Fvr Peter L. Peres Skickat: den 14 september 2002 12:45 Till: PICLIST@mitvma.mit.edu Dmne: Re: [EE] How to fade a LED? On Fri, 13 Sep 2002, Dal Wheeler wrote: >You might look at setting your pwm values with a lookup table if you >want to have a smooth bloom and dim cycle. LED's aren't linear on their percieved >light output. When I did them the table was more logrithmic. I ran into >this when working on a magic trick a few years ago... The led light output is VERY linear with led current at a given junction temperature, but your eyes aren't. Brightness does not mean the same thing when used between normal humans and engineers ... the eye sensitivity is logarithmic, so are most other human senses (like hearing and heat/cold sense f.ex.). A lookup table is not necessary if you use a power of 2 in the stepping. Peter -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads