Time Measuring


Closed Thread
Results 1 to 6 of 6

Thread: Time Measuring

  1. #1
    peterson's Avatar
    peterson Guest

    Question Time Measuring

    Hello
    I have bought a hall effect sensor (UGN3113).I want to measure with PIC16F628 the time between hall sensor triggers.How I can do that?
    Can anyone help me about time measuring with TMR?
    I wait for helpfull suggestions.
    Thanks alot.

  2. #2
    Join Date
    Jul 2005
    Posts
    78


    Did you find this post helpful? Yes | No

    Default

    How long is the interval? Microseconds? Seconds? Hours? Years?

    As the time gets longer, it gets easier as the accuracy issues tend to go to zero.

    For short intervals, I've done things like clear the timer counter (TMRx) internal to the PIC on the first pulse, interupt or poll for the 2nd pulse and at that time read the TMRx value. I'll feed TMRx with the PIC clock so its an accurate count of time.

    For long intervals, make a loop of a length suitable (seconds, hours, ect) and check inputs as above, keep the time in a register.

  3. #3
    Join Date
    Oct 2005
    Location
    Pinckney, Michigan
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    I've implemented tachometers with Hall effect sensors, using the PULSIN command. Works very well.

  4. #4
    peterson's Avatar
    peterson Guest


    Did you find this post helpful? Yes | No

    Smile Interval time

    Dear ErnieM
    Thanks alot for replying my qyestion. I am going to use ugn3113 for measuring the time of every complete wheel revolution.I use this time for controlling the other section of plant.The maximum time of interval is about 0.8 sec.Can you help me for writing basic code for this part of my program?

  5. #5
    peterson's Avatar
    peterson Guest


    Did you find this post helpful? Yes | No

    Default pulsin command

    Hi dear J. Mark Wolf

    thanks alot
    thr pulsin command is very good for use but i have a question.Does this instruction work in the background of main program? This means that can PIC execue other instructions in main program when the PULSIN command is executed at the same time.

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


    Did you find this post helpful? Yes | No

    Default

    If you need something running in background, you need to use internal Timer or CCP module or something like that. Now it works in background.

    With interrupts it will work great. Start a timer on rising edge of your signal and stop it on the next. OR, use a prescaller to get some sample of it, then divide it by the prescaller value. That way you may avoid some odd results.

    read the following document
    http://ww1.microchip.com/downloads/e...Doc/41214a.pdf
    Last edited by mister_e; - 20th May 2006 at 17:26.
    Steve

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

Similar Threads

  1. need help for measuring two freq at same time
    By vu2iia in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 3rd January 2009, 04:48
  2. I don't understand this code!
    By Russ Kincaid in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 13th February 2008, 02:55
  3. Measuring time
    By AugustoPedrone in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 30th July 2007, 23:46
  4. Serout2/serin2 Pbp Problem
    By SOMRU in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th December 2006, 19:55
  5. Timer in real time
    By martarse in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 29th July 2005, 14:24

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