Timer Accuracy


Closed Thread
Results 1 to 9 of 9

Thread: Timer Accuracy

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    It would help if you gave us an idea of what are you are using your "exact second" for, and why it has to be so accurate.

  2. #2
    GEEZER's Avatar
    GEEZER Guest


    Did you find this post helpful? Yes | No

    Default Timer Accuracy

    Actually, Melanie, hundreths or thousandths would be even better. I am monitoring the current flow through transistors and keeping track of the mAH as it counts up on the LCD. When the current stops the count stops. I will be monitoring the current through 4 transistors simultaneously. With a time reference that each sub program can access, the math in the sub program can make the calculations and display them on the four lines of the LCD. When the current flow stops, the readings will remain on the LCD until the user decides otherwise.

    I can do this with seconds, but the math will work even better with hundredths or thousandths, without floating point.

  3. #3
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    You're obsessed! Look, you're charging/discharging batteries for Gawds sake, not measuring the velocity of a speeding bullet!

    Who cares if it's exactly an hour, or an hour and 15 seconds...

    Do your ADC's, do your calculations (assuming a 100mS time interval), insert a Pause 100 and simply Loop. Just forget the time for the ADC's to operate and your math time. Just do a Pause 100.

    The first time you run your program insert a message to appear on your LCD after 36000 loops... (an hours worth of 100mS loops). You run a stop-watch and compare your watch against the PIC. You'll probably find it'll be an hour and a few minutes. Calculate the overspill time and reduce the Pause 100 statement accordingly. Hey presto - you're done.

    Now, if it ends up a few seconds out per hour, the batteries aren't going to care, after all they're a big chemical pile and you can't predict how chemicals will react from charge to charge, let alone down to fractions of a second. You're going to charge a 2200mAH Battery for example... it'll behave differently when factory fresh to when it's a year old. Best guess is close enough. So if you're charging a Battery for an hour, so what if you charge for one hour, one minute and seventeen seconds? It's not going to hurt.

  4. #4
    GEEZER's Avatar
    GEEZER Guest


    Did you find this post helpful? Yes | No

    Default Timer Accuracy

    Very perceptive Mel, I'm impressed! I'll give it a try. 15 sec. an hour is less than 1%, I could live with that. One minute and fifteen seconds would not let an obsessed geezer sleep at night.

    I am an old broadcast engineer, +/- 20 cycles per million in the days of vacuum tubes and crystal ovens. I'm too old to change very much now.

    I didn't expect the pause command would be that accurate, but i'll try anything once.

    This is a great forum, lots of idea exchange, and helpful people. It's a fast track for those just getting started, especially the chronologically handicapped.

    Thanks for your help.

    The obsessed Geezer

Similar Threads

  1. Elapsed Timer Demo
    By Darrel Taylor in forum Code Examples
    Replies: 111
    Last Post: - 29th October 2012, 17:39
  2. High Resolution Timer & Speed Calculator
    By WOZZY-2010 in forum Code Examples
    Replies: 4
    Last Post: - 7th February 2010, 16:45
  3. Timer + rc5
    By naga in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th November 2009, 07:56
  4. Timer interrupt frequency
    By Samoele in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th January 2009, 23:49
  5. timer interupt help 16f73
    By EDWARD in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd July 2005, 08:41

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