PDA

View Full Version : dim a led



fred.pacc
- 21st November 2006, 15:06
hello, I would like dim 2 leds with a 16f628 and I wanted to know which function to use but if I use the function pwm the program is very slow


regards
fred

mat janssen
- 21st November 2006, 15:41
Then you may try the Hpwm function (only one) or write your own pwm that is faster then.

fred.pacc
- 21st November 2006, 16:15
thanks

how one can create his pwm?


fred

mat janssen
- 21st November 2006, 17:49
pwmxl:
if cntr = 0 then outputport = 1 'this clears all pwm ports
if cntr = dutycl then outputport = 0 'this line can be repeated for as
'many as you have pwm outputs
cntr = cntr + 1
if cntr = 0 then exitpwm
goto pwmxl
exitpwm:
return

I hope the rest you figger out by yourselfs !