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.

Fading in and out leds using just a pic

Status
Not open for further replies.

trevelyn

Newbie level 5
Newbie level 5
Joined
Jan 2, 2003
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
74
is it possible to 'fade' a led in and out using just a pic and some software?
i am experimenting with a timer (interrupt) routine that turns the led on and off quickly. the leds don't 'fade' very well though.
 

Yes, it's possible.

Try with a timer, the goal is to make a PWM generator (ie : one one period for example 10µs, put led on x µs and off 10-xµs)

If it should have 10 step, a timer that run at 1kHz is good. (10µs timebase)
Some PIC should already have PWM generator, so the interupt frequency can be reduced.

After that, if it should decrease really smothly, the interrupt frequency shoulf be high (10kHz, 100 kHz) or it's necessary to use some tricks (multiple pins, variable timebase, and so no)
 

Good idea is to use a PIC with hardware implementation of PWM - 16F87X for example. In this case you will have 256 steps of brightness. The problem is , if you need to controll more then 2 LEDs because these MCU have only 2 PWM outputs.
 

Thanks. I'll try to come up with a software controlled PWM scheme
 

Just one hint. The problem in pwm controll of LED's brightness is in nonlinear brightness response to pwm ratio. So, incremenents should be corrected if you want smooth characteristic.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top