I'm trying to understand the innerworkings of generating a pwm signal from a pic18f4550.
Here are the specs fo the pic/board:
Internal clock of the pic18f4550 = 48MHz
External clock (crystal) = 20MHz
I need the pwm period to be 20ms and the duty cycle of the servo to be 1-2ms to turn the servo left or right. Therefore the following calculation should give me the period.
20,000,000/(255+1)x16x4 = 1220.70Hz for the pwm frequency. This doesnt seem correct though. Can someone help me determine what my Timer2 prescale, Timer2 postscale, and PR2 variables should be?
Thanks!
Phil
Here are the specs fo the pic/board:
Internal clock of the pic18f4550 = 48MHz
External clock (crystal) = 20MHz
I need the pwm period to be 20ms and the duty cycle of the servo to be 1-2ms to turn the servo left or right. Therefore the following calculation should give me the period.
20,000,000/(255+1)x16x4 = 1220.70Hz for the pwm frequency. This doesnt seem correct though. Can someone help me determine what my Timer2 prescale, Timer2 postscale, and PR2 variables should be?
Thanks!
Phil