How long does PULSIN wait for a pulse?


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323

    Default How long does PULSIN wait for a pulse?

    I just know this has been covered before. Or maybe not because the answer is too obvious and I'm just too blind to see...

    The manual states:
    " The measured width is placed in Var. If the pulse edge never happens or the width of the pulse is too great to measure, Var is set to zero. "

    So how long is "never happens" or "too great to measure"?

    When I use PULSIN inside a loop to look for an IR signal it really slows things WAY down....

    Thanks

    steve

  2. #2
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    The resolution of PULSIN is dependent upon the oscillator frequency. If
    a 4MHz oscillator is used, the pulse width is returned in 10us increments.
    If a 20MHz oscillator is used, the pulse width will have a 2us resolution.
    Defining an OSC value has no effect on PULSIN. The resolution always
    changes with the actual oscillator speed.
    PULSIN normally waits a maximum of 65535 counts before it determines
    there is no pulse.
    With a 4MHz clock that works out to be 655mS (or 131mS at 20MHz).

  3. #3
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    DEFINE PULSEIN_MAX counts will specify the time to wait.

  4. #4
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    PULSIN normally waits a maximum of 65535 counts before it determines
    there is no pulse.
    Thanks rmteo,
    I kind of guessed that from the length of time it took, but I didn't find it in my search. The "help" file in MCS didn't really go there.

    Dave,
    Bingo!
    "DEFINE PULSEIN_MAX counts" is exactly what I needed. I only need to look for 500 counts, so 65K+ was a bit much.

    The DEFINE sped my loop up a LOT and works great. A bit embarrassed I didn't find it on my own. Thanks to both you guys for pulling the blindfold off .

    steve

Similar Threads

  1. RC5 code for infrared receiver
    By Dennis in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 11th January 2017, 12:34
  2. Pulse Capture and byte building
    By boroko in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 21st July 2009, 01:59
  3. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 21:07
  4. Better understanding PULSIN
    By Wirecut in forum mel PIC BASIC
    Replies: 12
    Last Post: - 29th June 2008, 10:17
  5. Funny PULSIN values: what is going on???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 30th April 2008, 08: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