Duty Cycle


Results 1 to 11 of 11

Thread: Duty Cycle

Threaded View

  1. #5
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: Duty Cycle

    The 253 in my example relates to the duty cycle required...

    Assume 8 bit PWM ...the maximum duty cycle (100% ...full on) would be a value of 255 (a value of 0 being the minimum), a 50% duty cycle would be 127 ...and so on.

    Therefore for 8 bit pwm a setting of 255 = 100% duty (remember 0 is the first value ...so that all amount to 256 possible values) ...for the purposes of calculation we can call 100% a duty of 1.

    So in my earlier example, the duty in place (253) would be a 253th of 256 possible values or ......1/256 * 253 ...which is 98.828125%.

    We're not talking 'time' as such here ...but a ratio of on to off.

    The problem with a PWM frequency of 38Khz is that - depending on your PIC Clock - you might not be able to use 256 values of PWM (the amount of pwm bits available is inverse to your chosen PWM frequency)...a quick check with Mister E's Pic multicalc (http://www.picbasic.co.uk/forum/show...8308#post78308) shows that at 38.462 KHz and a PIC oscillator setting of 8Mhz, you've actually only 210 bits of pwm available to you ..... therefore for 50% duty, you'd need a duty cycle register value of 105 & so on.
    Last edited by HankMcSpank; - 28th September 2011 at 14:02.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts