View previous topic :: View next topic |
Author |
Message |
srikrishna
Joined: 06 Sep 2017 Posts: 82
|
Some question regarding pwm |
Posted: Wed Apr 08, 2020 6:31 am |
|
|
Hello guys i have some question regarding PWM.
What does it mean by pwm master-slave?? Why it is called master-slave?? |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9244 Location: Greensville,Ontario
|
|
Posted: Wed Apr 08, 2020 7:48 am |
|
|
Where did you copy/paste that information from ? I've loooked at the datasheet I have and didn't see it...... |
|
|
srikrishna
Joined: 06 Sep 2017 Posts: 82
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Apr 08, 2020 9:15 am |
|
|
The 18F4550 data sheet says:
Quote: |
15.4.2 PWM DUTY CYCLE
CCPRxL and CCPxCON<5:4> can be written to at any
time, but the duty cycle value is not latched into
CCPRxH until after a match between PR2 and TMR2
occurs (i.e., the period is complete). In PWM mode,
CCPRxH is a read-only register.
|
Refer to FIGURE 15-3: SIMPLIFIED PWM BLOCK DIAGRAM:
The PWM comparator needs the duty cycle to be held
constant during the PWM cycle. But, Microchip wanted the
user to be able to update the duty cycle value at any time.
So they made two registers for PWM duty cycle.
You can change the 1st stage (CCPRxL) at any time.
But the 2nd stage (CCPRxH) is only loaded with the value
in CCPRxL at the end of every PWM cycle. So in that sense
CCPRxH is a "Slave" of the CCPRxL register. |
|
|
Charles Francês
Joined: 29 Feb 2020 Posts: 7
|
|
Posted: Mon Apr 27, 2020 9:41 am |
|
|
if you're looking to use pwm, you can also do it without CCP. set_power_pwm_override (pwm, override, value) - This function determines whether the OVDCONS or the PDC registers determine the PWM output.
setup_power_pwm (config) - Sets up the PWM clock, period, dead time etc.
setup_power_pwm_pins (module x) - Configure the pins of the PWM to be in Complementary, ON or OFF mod.
set_power_pwmx_duty (duty) - Stores the value of the duty cycle in the PDCXL / H register. This duty cycle value is the time for which the PWM is in active state.
set_power_pwm_override (pwm, override, value) - This function determines whether the OVDCONS or the PDC registers determine the PWM output. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19541
|
|
Posted: Mon Apr 27, 2020 9:48 am |
|
|
No.
He is using the PIC18F4550, which does not have the power PWM module. |
|
|
|