Better understanding PULSIN


Results 1 to 13 of 13

Threaded View

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


    Did you find this post helpful? Yes | No

    Wink A Solution to measure following levels ...

    Hi, Wirecut

    Pulsin is a command that MUST wait for the leading edge ...

    so, if you want to measure, say a PWM signal, you're tempted to Write :

    PULSIN Input, 1, Hilev1
    PULSIN Input, 0, Lolev1
    ...

    ... Am I right ???

    But using Pulsin twice will do the Following :

    READ correctly the High level ...
    RESET it's detection mechanism ( some µs necessary !!! )
    WAIT for an incoming falling edge
    READ the Low level pulse
    RESET it's detection mechanism ( some µs necessary !!! )
    WAIT for an incoming rising edge
    READ the High level pulse


    then it doesn't see the falling edge for the 1st following Low level ( has happend some µs ago !!! )

    THEN it will wait for the NEXT falling edge ... wich is the SECOND low level state ...

    so, let's resume ...

    you read hi state 1, lo state 2, hi state 3, lo state 4

    INSTEAD of : hi state 1 , lo state 1, hi state 2, lo state 2 .... etc, etc

    TURNAROUND ...

    PULSIN Input, 1, Hilev1
    RCTIME Input, 0, Lolev1
    RCTIME Input, 1, Hilev2
    RCTIME Input, 0, Lolev2
    ...

    if using a 4Mhz clock, add 1 unit correction to RCTIME measured values

    if using a 20 Mhz clock, add 4 units to RCTIME Measured values

    And now, you'll get your values right !!! ... or very, very, very, very close, to be honest !!!

    Alain
    Last edited by Acetronics2; - 9th May 2008 at 12:47.
    ************************************************** ***********************
    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 : 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