Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
ptewright said:I'm trying to setup a PIC for PWM. I want a period of 1 second. I am using a 4MHz clock. What values should PR2 and, TMR2 prescale should be used? If I want a 50% duty cycle, what values should CCPR1L and CCP1X and CCP1Y be? I'm having trouble calculating that.
ptewright said:Hi,
I'm trying to setup a PIC for PWM. I want a period of 1 second. I am using a 4MHz clock. What values should PR2 and, TMR2 prescale should be used? If I want a 50% duty cycle, what values should CCPR1L and CCP1X and CCP1Y be? I'm having trouble calculating that.
Thanks
ptewright said:Basically, what i'm trying to do is setting the pwm for a certain frequency for about 0.5s, turning that off for 0.5s, so the period would be 1s. Then for the next period, I want to set the pwm to another frequency for 0.5s and turn that off for 0.5s.....etc.....
Is that possible with the PIC? I can't seem to get that working right.