Whilst your program is executing your PWM command it is stuck there at that command... ie it can't do anything else unless you roll your own with a whole heap of clever interrupt processing.
Many PICs have HARDWARE PWM. That's great because you set it and forget it. It'll continue to run in background whilst you go and play Tetris on your LCD display or whatever. See HPWM Command.
Some PICs have more than one PWM Channel... Hence Channel 1 or Channel 2 etc... you might have a problem finding six.
Give a Guy an inch or two and he'll want six... typical!
You can always make your IF statements a little more complex...
if (DC_In < Optimum +3) or (DC_In > Optimum -3) then blah
... but you might find it uses more code than two seperate statements.
Bookmarks