The following works for setup:
pwm setup declarations
PTCON0 = %00000000 '1:1 postscale,1:1 prescale,Free running mode
PWMCON0 = %01111110 'all odd PWM I/O enabled,PWM pairs in Independant Mode
PWMCON1 = %00000001 '1:1 Postscale special event trigger,special event trigger occurs counting up, Updates from duty cycle and period buffer registers enabled, Output overrides via the OVDCON register are sycronized to the PWM time base.
OVDCOND = %00101010 'Output on PWM I/O is controlled by the value in the Duty Cyle register and PWM time base - for POVD1,POVD3,POVD5
PWMresolution VAR Word bankA
PWMresolutionL VAR PWMresolution.byte0
PWMresolutionH VAR PWMresolution.byte1
PTCON1 = %10000000 'PWM Time base is on
PWMresolution = 4064
PTPERH = PWMresolutionH
PTPERL = PWMresolutionL
' take your desired PWM value and put to PDCx L and H
There does seem to be an issue when using the PWM in the low values.
Just before the duty cycle is zero, it seems to flash to 100%.
Anyone else experience this?
Bookmarks