Better understanding PULSIN


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink

    Hi,

    But why should the preference go for a PULSIN command first?
    ... just to be sure to catch the first pulse ... RCTime is somewhat "out of normal use" for the leading pulse ... result is not guaranteed !!!


    Any idea why I get a result of 0 or 1 at bit 8 (sometimes bit 7)?
    your scoping looks strange ... just at bit 8 !!! ... try to raise the TSOP decoupling caps value and to place a ~ 50 - 100 pF as load to the TSOP output - that could catch possible ns glitches ...

    Also take care to have neat 0-5 v levels : the pic Thresold is @ ~1.5 v for TTL inputs ... and Schmitt trigger needs "good" levels ...

    Have a nice evening

    Alain
    Last edited by Acetronics2; - 28th June 2008 at 19:46.
    ************************************************** ***********************
    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 " !!!
    *****************************************

  2. #2
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default

    Merci Alain,

    I can't see any change with the decoupling cap and the power is ok. I'll go for some other values and check again.

    PBP manual: PULSIN normally waits a maximum of 65535 counts before it determines there is no pulse.
    It looks to be the same for RCTIME... but as you say, RCTIME has not the same behaviour as PULSIN.

    I think, depending on the IR remote type and protocol, I miss the first bit of the pattern.

    Is it possible to make PULSIN scan a pin without time limitation (=until a signal is detected)?
    Roger

  3. #3
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Okay now

    Hi,

    To make PULSIN wait "forever" for an incoming signal, I added:
    Code:
    LOOP1:
    PULSIN p_in, 0, l_Bit[Ctr_A]    ' measure neg leading pulse
    if l_Bit[Ctr_A] = 0 then LOOP1:
    led1 = 1
    RCTIME p_in, 1, h_Bit[Ctr_A]    ' measure time staying High
    for Ctr_A = 1 to (bit_count - 1)
       rctime p_in, 0, l_Bit[Ctr_A] ' measure time staying Low
       rctime p_in, 1, h_Bit[Ctr_A] ' measure time staying High
    next Ctr_A
    RCTIME p_in, 0, l_bit[bit_count]
    Thanks again for the RCTIME info, Alain. Is there something you don't know about, hein???

    Bon dimanche et bonnes salutations hélvètes!!!
    Roger

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


    Did you find this post helpful? Yes | No

    Wink

    Quote Originally Posted by flotulopex View Post
    Is it possible to make PULSIN scan a pin without time limitation (=until a signal is detected)?
    Hi, Roger ...

    Of course :

    place a waiting loop,

    you detect the first pulse with an interrupt: Alain's interrupt is the best here for latency ... as there is nothing to save ! ( RCTime is to use at first here !!! ) and place your RCTime's "gang" in the interrupt stubb ...

    ( no RETFIE or GOTO needed ! )

    then, your display routine ...

    Then back to the waiting loop.



    now, for better precision ...

    you should use

    PULSIN
    RCTIME
    RCTIME
    RCTIME
    ...

    instead of a FOR-NEXT Loop ...


    Is there something you don't know about, hein???
    Easy answer is ... WOMEN !!!

    True answer is Biology, Medicine and such specialities ... more generally what do not accept a mathematical model !!! ( at least yet ...)

    One exception : Horses !!!

    Have a nice Sunday

    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 " !!!
    *****************************************

Similar Threads

  1. Replies: 17
    Last Post: - 12th April 2014, 02:17
  2. pulsin: how is it used
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 8th October 2008, 00:11
  3. Funny PULSIN values: what is going on???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 30th April 2008, 08:02
  4. Pulsin 16F819 problem
    By rekcahlaer in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 11th April 2007, 13:52
  5. PULSIN and RCTIME
    By Dwayne in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th November 2004, 14:45

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