Hi,
Took a quick look at the code you PM'd me and found this:
Code:
'If light=1 then ' If the variable is 1 then output full PWM to lights
' hpwm 1,255,200
' hpwm 2,255,200
'endif
'If light=0 then ' If the variable is low then set value to 0 an turn off the lights
' hpwm 1,0,200
' hpwm 2,0,200
'endif
If this is where you're trying to set 100% dutycycle but ends up with a "jumpy" signal not at 100% then the problem is most likely that you're trying a frequency (200Hz) far below the specified minimum. If you look at the manual you'll see that for a 18F device running at 20MHz the minimum frequency is 1221Hz.
The only other place in the code where HPWM was used had a frequency of 5kHz so that should've worked - did it?
/Henrik.
Bookmarks