Hi,
There's lots of ways to acomplish what you want, most of them involve some kind of PWM generating. Generating that PWM can be done with PBP's PWM command for a software-only-aproach or by the PICs hardware CCP module.
If dimming that LED up and down is all you want then something quick and dirty like this might do the trick:
Code:
TRISB.7=0 'Set PortB.7 to output, connect LED here.
DutyCycle VAR byte
Start:
For DutyCycle = 0 to 255
PWM PortB.7, DutyCycle, 10
Next
For DutyCycle = 255 to 0 Step -1
PWM PortB.7, DutyCycle, 10
Next
Goto Start
That's one way...also have a look at the HPWM command and search this forum for Darrel Taylors software PWM routines.
/Henrik.
Bookmarks