Trying to measure time between two pulses on different pins.


Closed Thread
Results 1 to 27 of 27

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Trying to measure time between two pulses on different pins.

    A quick read through your code and I do not see a problem. So the big question...
    Does it work as expected?
    If so Then NoProblem...
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Sep 2006
    Location
    Indiana, USA
    Posts
    72


    Did you find this post helpful? Yes | No

    Default Re: Trying to measure time between two pulses on different pins.

    Nope,

    It didn't work. I did catch a few mistakes as soon as I posted that. Like needing to comment my assembly stuff with ";" for example. And never flipping "FirstCapt" back after looking for the second pulse. And I had to play with the TMR0prescaler some more. The code I posted before this was running at 120Hz instead of 60Hz.

    I think I would have to find a way to keep proper order and timing of when my interrupts fire. When I corrected the above mistakes and ran that code, my output varibles would lock onto a certain value and stay that way. Almost as if the CCPs were firing as soon as their interrupts were enabled. I tried all sorts of stuff and never had any luck with getting it to all work together.

    I ended up using what Henrik had come up with for the 16F648A, I just got it to work on the 18F2320 and rolled in capturing with the CCP modules instead of the port B pins. It samples both CCPs 5 times, averages the results and breaks one of them out into 16 discrete "levels" before outputing via HSER.

    I need to tweak some things yet. But I'll post what I came up with soon and explain what it's for.

Similar Threads

  1. Measure time in mS between two pulses
    By Fredrick in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 7th March 2011, 08:20
  2. time measurement between 2 pulses
    By xvladx in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 27th April 2010, 18:33
  3. calculate time between pulses
    By hell_pk in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 20th October 2007, 17:49
  4. Count pulses between VARIABLE TIME
    By RodSTAR in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th October 2007, 13:44
  5. Timed pulses on 2 pins
    By Danie Joubert in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 15th March 2004, 08:38

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