Hi,
I've tried it here, on a real physical PIC, and it works just fine.
I see that you've removed the Pause statement I had in there. If you don't have a delay there it will run thru the different dutycycles much faster then the actual PWM frequency. It tries to update the dutycycle registers several times during each PWM period which obviously won't work properly.
Your PWM frequency is 5kHz so if you really do want to see "all the steps" you must have atleast 1/5000=200us between updates. I measured the execution time of the loop to around 25us with a 20Mhz oscillator so you're basically trying to update the dutycycle 8 times every PWM period.....
Bookmarks