Some question regarding pwm of PIC microcontroller

Thread Starter

khatus

Joined Jul 2, 2018
84
Hello guys i have some question regarding PWM.



What does it mean by pwm master-slave?? Why it is called master-slave??
 

BobTPH

Joined Jun 5, 2013
2,348
I think they are referring to the fact that there are actually two registers, You write to one, then, at the end if the next PWM period, it is copied to the actual register. This allows updating the register without disturbing the current cycle.

Bob
 

MaxHeadRoom

Joined Jul 18, 2013
20,426
The register using the PWM mode is a 10bit register. using a 8 bit (high) and 2 bits for the LSB (low)
See this link for calc and the position of the 2 LSB <5:4>.
https://www.micro-examples.com//public/microex-navig/doc/097-pwm-calculator.html

Page 146 of the manual.
15.4.2 PWM DUTY CYCLE
The PWM duty cycle is specified by writing to the
CCPRxL register and to the CCPxCON<5:4> bits. Up
to 10-bit resolution is available. The CCPRxL contains
the eight MSbs and the CCPxCON<5:4> bits contain
the two LSbs. This 10-bit value is represented by
CCPRxL:CCPxCON<5:4>. The following equation is
used to calculate the PWM duty cycle in time:
Max.
 
Last edited:
Top