defining max pulsin time with duty cycle 100%


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2007
    Posts
    10

    Default defining max pulsin time with duty cycle 100%

    Hello,

    I have a problem with pulse width measurements. I am trying to measure pulse widths from a signal that has a duty cycle from 0%-100%. The problem I am facing is that the define pulsin max does not behave the way I had anticipated. For instance, the signal I am measuring has a period of about 9 ms. So, I was expecting that defining pulsin max at 900 would return a variable value of 900 when duty cycle was 100% (always high). However, the variable gets set at "0" instead.

    My boards are already made and the pwm signal is already assigned to portc.2, so I cannot use the CCP module, or the interupts on change from portB.

    Any suggestions for measuring this signal?

    Or, Is there a way to modify the Pic basic command so that a 100% duty cycle would return the defined pulsin max value, instead of 0?

    Thanks!

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


    Did you find this post helpful? Yes | No

    Wink

    Hi, Patrice

    The problem is Pulsin needs a leading and a falling edge to work ... so 0 and 100 % do not trigger it ...

    the way is test your input as soon as pulsin sends a zero ... ( after timeout, tho )

    suppose pulse High :

    Code:
    Pulsin Portpin, 1 , result
    
    IF result = 0 THEN 
        IF PortPin THEN 
           LCDOUT $FE,2 " Pulse > 900 "
        ELSE
           LCDOUT $FE,2 " No Pulse "
        ENDIF
    ENDIF
    no need to tweak the Pulsin Command ... just use logics !

    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