Hi flotul,
It won't matter that the Duty variable ends up at 0 when it wraps around. The HPWM will stay at the last DutyCycle it was set to "Inside" the FOR/Next loop. So you can go the full 0-255.
It appears that you are using the "if duty = 0 then" statement to make the backlight only ramp-up once, when power is applied. Which also means that you have this section of code within the Main Loop of the program.
If you take it out of the main loop and put it up at the top of the program, that section of code will only run once.
<br>
Bookmarks