1
\$\begingroup\$

Im messing around with PIC18F25k50 standard mode PWM.

I found something weird. Datasheet says, that PWM is 10-bit, and timer is 8-bit.

How that can be?

enter image description here

Is that datasheet is wrong, or my english is too bad to understand that correctly?

What is the point of 10-bit PWM with 8-bit timer?

\$\endgroup\$
3
  • \$\begingroup\$ Where did you get that timer (which one?) is 8-bit? I don't see it in the snippet from the datasheet. \$\endgroup\$ Jun 16 '14 at 15:12
  • \$\begingroup\$ Timer2 in PIC18F25k50 is 8-bit for sure. "The maximum PWM resolution is 10 bits when PR2 is 255". Maximum PR2 value is 255 (PR2 is stored in single 8-bit register). \$\endgroup\$
    – Kamil
    Jun 16 '14 at 15:13
  • \$\begingroup\$ This is clearly answered in the datasheet right where you'd expect to find it. Duh. \$\endgroup\$ Jun 16 '14 at 15:48
4
\$\begingroup\$

See the datasheet:

enter image description here

Either two bits of the timer prescaler or the divider for the internal system clock is used for the two LSBs.

Similarly, the duty cycle value storage is split between CCPRxL and CCPxCON<5:4> as shown.

\$\endgroup\$
2
  • \$\begingroup\$ So... I have to change prescaler to get 1024 diffrent pulse width values? \$\endgroup\$
    – Kamil
    Jun 16 '14 at 16:50
  • \$\begingroup\$ Nope just load CCPRxL and CCPxCON<5:4>. \$\endgroup\$ Jun 16 '14 at 17:08
1
\$\begingroup\$

I don't know about that chip specifically, but some PIC PWM peripherals can make use of the timer prescaler bits to create "extended" resolution.

\$\endgroup\$
0
\$\begingroup\$

The datasheet states on page 189 that the timer is combined with two clock bits or prescaler bits to create the 10 bit pwm counter.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.