pulsin question


Closed Thread
Results 1 to 6 of 6

Thread: pulsin question

  1. #1
    Join Date
    Apr 2006
    Location
    Michigan
    Posts
    70

    Default pulsin question

    Question about the pulsin command. Lets sayd I do Pulsin portb.0,1,var. Does it have to see a low to high transition before it starts counting, and then it stops counting when it sees a high to low transition? Or does it start measuring as soon as it sees the pin is high until the high to low transition. I am just curious if I need something in my program to filter that out. Maybe put the pulsin comman in an if statement. something like:

    If Portb.0=0 then
    pulsin portb.0,1,var
    end if

    This way I only start the pulsin comman when my signal is at 0 assuring that I will capture the entire high signal. Any help would be appreciated. The manual doesn't seem to explain this well.

  2. #2
    Join Date
    Feb 2006
    Posts
    89


    Did you find this post helpful? Yes | No

    Default What type of pulse are you mesasuring

    What type of pulse are you measuring?

  3. #3
    Join Date
    Apr 2006
    Location
    Michigan
    Posts
    70


    Did you find this post helpful? Yes | No

    Default

    It is a PWM signal 0 to 5 volts. Rather than setup an RC circuit to get an analog voltage I am measuring the low time and high time and then finding the duty cycle from there. Just curious if the command waits for a transition to start the timer, or if it starts whenever the pin is in the desired state even if it has been there for some time. It actually works very well. I just wanted to understand the command a little better. The manual says that it turns off on a transition, but it doesn't say if the timer turns on on a transition.

  4. #4
    Join Date
    Feb 2006
    Posts
    89


    Did you find this post helpful? Yes | No

    Default No clue

    I have no clue. Sounds like a Melanie or Bruce question. I think that it starts at the zero axis and stops on the turn down or turn up, but I am not for sure.

    Sorry,

    Travin

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Never test it but i hope it wait for a rising or falling edge. Usually i prefer to use the internal Timer or the PIC CCP module.

    As it works.. you may stick to PULSIN or read the CCP tips and trick document of microchip bellow.
    http://ww1.microchip.com/downloads/e...Doc/41214a.pdf
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    Join Date
    Apr 2006
    Location
    Michigan
    Posts
    70


    Did you find this post helpful? Yes | No

    Default

    It actually works great. I put two of the same pulsin commands next to eachother. That way if the first one only catches part of the pulse, the second one will get the whole one. Not very efficient, but I am not making anything real complicated and I have the resources to spare. I will keep it that way until I know for sure how the command works. When I compare my calculated duty signal to a DVM, the two are the same.

Similar Threads

  1. Replies: 17
    Last Post: - 12th April 2014, 02:17
  2. Better understanding PULSIN
    By Wirecut in forum mel PIC BASIC
    Replies: 12
    Last Post: - 29th June 2008, 10:17
  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 Math question
    By ruijc in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 2nd April 2008, 16:15
  5. PulsIn question.
    By Peter Oors in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 15th January 2006, 22:03

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