CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Some question regarding pwm

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
srikrishna



Joined: 06 Sep 2017
Posts: 82

View user's profile Send private message

Some question regarding pwm
PostPosted: Wed Apr 08, 2020 6:31 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Apr 08, 2020 7:48 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Apr 08, 2020 9:08 am     Reply with quote

temtronic wrote:
Where did you copy/paste that information from ? I've loooked at the datasheet I have and didn't see it......


https://openlabpro.com/guide/pulse-width-modulation-using-pic18f4550/?fbclid=IwAR1F5gvyOoRuyLKv5H8vVd5Rd2eP2xZnNgKubEO9QSic8MgpsQPmfPsE6s4
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Apr 08, 2020 9:15 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Apr 27, 2020 9:41 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Apr 27, 2020 9:48 am     Reply with quote

No.
He is using the PIC18F4550, which does not have the power PWM module.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group