1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Pwm resolution concept

Discussion in 'Microcontrollers' started by elecLear78, Jun 1, 2017.

  1. elecLear78

    elecLear78 Member

    Joined:
    Jul 16, 2013
    Messages:
    226
    Likes:
    1
    Location:
    india
    Iam bit confused with pwm resolution in pic controllers. Generally i am using the following equation to calculate ptper reguster
    Frequency of clock/ pwm frequency = ptper value. The duty cycle is loaded based on the value of ptper value

    Pdc = ptper * duty cycle / 100.
    Now my confusion is the pwm resolution. What exactly is this, should i calculate everytime. Please advise.
     
  2. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,165
    Likes:
    910
    Location:
    Rochdale UK
    ONLINE
    Try to think of it this way...

    - Timer 2 will count until it equals PR2 and then it starts again this is the frequency..

    - CCPRxL combined with the two DCB bits in the CCPxCON determine when the pin is high or low..

    - If Timer 2 < CCPRxL + DCB1+DCB2 then the pin is high otherwise the pin is low...

    The best explanation is in the pic12f1840 datasheet....

    Don't let the register name upset you... These are the original names...

    Once the ptper (PR2 ) is set and the Timer is configured... All you need to change is the CCPRxL ( OCxR) register.

    What chip are you actually using...
     
  3. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,899
    Likes:
    502
    Location:
    Cleveland, OH, USA
    ONLINE
    Resolution is the number of steps (e.g., duty cycle values) allowed between the lowest value (often 0% ) and the highest value (often or close to 100%).

    This site will calculate the register values and show how many resolution bits there will be in the results.
    http://www.micro-examples.com/public/microex-navig/doc/097-pwm-calculator.html

    John
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. hugo

    hugo New Member

    Joined:
    Aug 9, 2003
    Messages:
    18
    Likes:
    0

    You can think of resolution like the number of segments needed for the 'period' of time, so for 10 bit there are 1024 segments.
    A 50% duty cycle means that for 512 segments the signal is on and for 512 segments is off.
     
  6. elecLear78

    elecLear78 Member

    Joined:
    Jul 16, 2013
    Messages:
    226
    Likes:
    1
    Location:
    india
    Ok Thank you very much, now i can understand.
     
  7. MikeMl

    MikeMl Well-Known Member Most Helpful Member

    Joined:
    Mar 17, 2009
    Messages:
    11,049
    Likes:
    541
    Location:
    AZ 86334
    If you perfectly low-pass filter the PWM signal to a DC level, and the PIC is powered with 5.000Vcc, then you get 1023 = ((2^10)-1) equal steps from 0V to 5.000V*1023/1024 = 4.995V. The step size is 4.995V/1023 = 0.00488V
     
    Last edited: Jun 6, 2017
  8. MikeMl

    MikeMl Well-Known Member Most Helpful Member

    Joined:
    Mar 17, 2009
    Messages:
    11,049
    Likes:
    541
    Location:
    AZ 86334
    Hello Pradeep. Your question should really be posted in its own (new) thread; not appended to an existing thread which discusses a different topic...

    In LTSpice, there is a generic multi-winding transformer model which can be customized with a few parameters. I dont know how to do that in Proteus.
     
  9. Pradeep kumar Dharkar

    Pradeep kumar Dharkar New Member

    Joined:
    May 30, 2017
    Messages:
    2
    Likes:
    0
    Thank you Mike Mi
     

Share This Page