Measuring duty cycle when it can be 0 to 100.


Closed Thread
Results 1 to 4 of 4
  1. #1

    Default Measuring duty cycle when it can be 0 to 100.

    I have this measuring duty cycle bit down pretty good until the duty is either 0 or 100. For example, using CCP and signal is high all the time (100%) won't the timers both overflow when looking for high to low and low to high? Whats a good route to take to test for either condition? We went to watch the Parade of Lights last night in Denver so my brain is still half frozen, maybe I am missing something obvious.

    One thing is the frequency is a constant too.
    Last edited by Tobias; - 3rd December 2011 at 16:05.

  2. #2
    Join Date
    Jan 2009
    Posts
    78


    Did you find this post helpful? Yes | No

    Default Re: Measuring duty cycle when it can be 0 to 100.

    you mean 0 to 255 ?

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: Measuring duty cycle when it can be 0 to 100.

    No I have in incoming signal that has a duty cycle from 0 to 100%. The signal is running a motor. 0% duty cycle is motor not running at all. 100% duty cycle the motor is running full speed. I want to measure the duty cycle controlling the motor. Frequency is 125 hz for this incoming PWM. When the PWM is between 0 and 100% duty cycle I am good to go. When it is either 0(low all the time) or 100(high all the time) the overflow occurs.

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Smile Re: Measuring duty cycle when it can be 0 to 100.

    Hi, Tobias

    your signal lasts 8 ms @ 125 hz ...

    so , just measure time ...


    if signal high > 8 ms then it's 100% ...
    if signal low > 8 ms then it's 0% ...

    Was VERY cold in Denver, last night !!! don't you think ?

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Members who have read this thread : 1

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