ok.......so I set up my timer 2 and pwm.
I am operating at an oscillator frequency of 16KHz
with a timer 2 of:
Code:
setup_timer_2(T2_DIV_BY_1,255,1);
thus my period of PWM is: 64uS which s equal to 15.625KHz
The resolution of my PWM becomes 10-bit.
My question is, if PR2=255 at maximum and I have a 10-bit resolution PWM (0-1024) which determines what value the duty cycle could be. How, could this be possible.
How does one utilize a 10-bit resolution if PR2 is only 8-bit?????
I means that every time that TMR2=PR2 the pulse goes high.......however
if TMR2 reaches value in the duty cycle register PWM goes low.
If PR2=255 and the duty cycle is a10-bit number (say 512) then PWM will never happen the output will remain high always.....
Can anybody help me??
siwtchblademaster Guest
Posted: Tue Jul 21, 2009 3:20 pm
ok.........i have been thinking is it that:
if i have a 10-bit resolution and say duty cycle is 512 and pr2=255 then pwm:
(512/1023)*255
is that it?????
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Tue Jul 21, 2009 3:30 pm
Quote:
How does one utilize a 10-bit resolution if PR2 is only 8-bit?????
If you give the set_pwmx_duty() function a parameter that is larger than
8-bits, the compiler changes the generated code so that it's using 10-bit
mode.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum