Elapsed Timer Demo


Closed Thread
Results 1 to 40 of 112

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Naaa. Don't bother.

    Try Melanie's Olympic timer instead (cheers Darrel, you keally know how to make friends - Melanie). It doesn't have the ASM stuff to worry about.

    Or Paul's clock that doesn't even need interrupts.

    DT
    <br>

  2. #2
    Join Date
    Jun 2006
    Posts
    3


    Did you find this post helpful? Yes | No

    Default

    Just wanted to say thanks, works great on a 16F690.

    I was going to modify your program a bit, I have an application which uses count down timers, but I thought I should check with you, I noticed a copyright on the code.

    Thanks,
    Mike

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi Mike,

    Glad it's working.

    No problem with the copyright.
    You're free to use it any way you want. Well, except posting it somewhere saying you wrote it
    DT

  4. #4
    Join Date
    Jun 2006
    Location
    Bangalore, India
    Posts
    136


    Did you find this post helpful? Yes | No

    Question Having trouble getting accuracy

    Hi Darrel,
    I tried making a LCD clock with calender with the elapsed timer code, but the clock runs nearly 2 seconds slow per day.
    I've made some modifications to the Elapsed_INT.bas.txt file so attached that also with my code ...
    I dont know how to fix this error...
    What should i do?... try tweeking the TimerConst or something???
    Attached Files Attached Files

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi shahidali55,

    "tweeking the TimerConst" won't help. 1 count either direction will change the timing by more than you are off. @ 4mhz, 1 count will change the time by about 4 seconds per day.

    At 2 seconds per day, it works out to around 23 PPM (parts per million), which is within the normal 50 PPM tolerance of the crystal. Not to mention the +/- 100 PPM variance due to temperature.

    To get closer than that, you'll need to calibrate the crystal frequency. You may be able to use a small Trimmer Capacitor in place of one of the capacitors on the crystal. The size needed depends on your crystal, but 0-20pf will probably work.

    Other than that, you could simply add 1 second every 12 hours. But if you build more units, that could be problamatic since they won't all be the same.

    Here's a couple links to some more crystal info:
    http://www.circuitcellar.com/library...ujanos91/3.htm
    http://ww1.microchip.com/downloads/e...tes/00588b.pdf
    http://ww1.microchip.com/downloads/e...tes/00949a.pdf
    DT

  6. #6
    Join Date
    Jun 2006
    Location
    Bangalore, India
    Posts
    136


    Did you find this post helpful? Yes | No

    Question

    I dont think the problem is with the oscillator.
    I noticed that the time loss takes place every time the hours increase...
    Could it be some flaw in the code execution?

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    If its losing time on every change of the hour, and the total loss is 2 seconds per day, then each change of the hour would lose 1/12th or 0.083 seconds.

    @ 4mhz, that's 83,000 instruction cycles. No, I don't think it's accidently losing that many instructions to increment an hour. And, looking at the ClockCount interrupt routine, if that were the case, it would also happen on every second, minute, and day as well. Which it doesn't.

    Why don't you think it's the crystal?

    Have you measured the frequency?

    DT

  8. #8
    Join Date
    Jun 2006
    Posts
    12


    Did you find this post helpful? Yes | No

    Default

    Hi Guys.

    I'm writing a program to control a drag racing xmas tree and time the 1/4 mile but I need .0000 (ie thousandths) second accuracy.

    Looking a the ASM routine I'm wondering if I can just change the 100Hz freq to 1KHz by triggering the interupt more often.

    Will this work?

    Thanks and Regards

    Thirsty

  9. #9
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    That should work.

    But .0000 would be Ten Thousandths of a sec. That'll be harder.
    <br>
    DT

  10. #10
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    Using a 12F675 I am getting wsave position request beyond ram_end errors how do I fix this?

  11. #11
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by geckogrotto View Post
    Using a 12F675 I am getting wsave position request beyond ram_end errors how do I fix this?
    Open the ASM_INTS.bas file and comment out the offending lines.
    The 12F675 only has 2 banks of RAM.
    <br>
    DT

  12. #12
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    Thanks got it

  13. #13
    Join Date
    Jun 2006
    Location
    Bangalore, India
    Posts
    136


    Did you find this post helpful? Yes | No

    Question Sorry

    Sorry for posting that same message again...
    I was getting an error message...
    The attachment wasn't uploading correctly...
    Attached Files Attached Files

Similar Threads

  1. Instant Interrupts - Revisited
    By Darrel Taylor in forum Code Examples
    Replies: 772
    Last Post: - 17th February 2016, 22:14
  2. Get elapsed time while TIMER samples pulses
    By RodSTAR in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th March 2009, 16:27
  3. Elapsed Timer Demo in a PIC12F675
    By Leonardo in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 21st November 2008, 00:01
  4. Totally Baffled with Elapsed Timer
    By CocaColaKid in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th June 2008, 21:01
  5. Darrel Taylor Elapsed Timer
    By rwskinner in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 13th March 2008, 01:22

Members who have read this thread : 2

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