by sich » Thu Apr 28, 2011 11:56 am
You can use PR2 register to change the pwm period because T = Period, f = 1 / T. So when period changes, the frequency also different. However, the lowest frequency you can achieve is still very high, may be few thousand pulse per second. The best way should be setup a timer interrupt, fix the period for the timer to overflow and count a variable in the interrupt routine. So yo will change this variable matching value to determine when to toggle the pulse pin.