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

    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

  2. #2
    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?

  3. #3
    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

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


    Did you find this post helpful? Yes | No

    Post

    when i run Josepino's code, on the same board with the same crystal, i do not get any error.
    This is why I think it is a fault in the software...

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


    Did you find this post helpful? Yes | No

    Default

    Too bad the guy only gives out HEX files.

    Otherwise, we could see what special magic he has, to cancel out the tolerance of crystals.

    DT

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


    Did you find this post helpful? Yes | No

    Talking Finally, Got the accuracy

    Hi Darrel,
    Some where Josepino had mentioned on his site that he had used Roman Black's one_sec.asm routine in his clocks (maybe he mentioned this by accident).
    I tried making a similar program in PBP but had no success, till now.
    Finally i got the progam running. its the exactly same one_sec.asm routine running with instant interrupts, and guess what,... it worked, and really accurately...
    Its even more accurate than the Elapsed Timer...
    I'll post the code so that it may be useful for someone...
    (I'm not as mean and selfish as Josepino...
    and thanks a lot for the instant interrupts program...
    Chiao...
    Attached Files Attached Files

  7. #7


    Did you find this post helpful? Yes | No

    Talking Elapsed Timer

    Hello shahidali55,

    It can publish or to send to my mail [email protected] the code and complete circuit since is very interesting its project, congratulations for its idea!.

    Leonard

    Regards




    Quote Originally Posted by shahidali55
    Hi Darrel,
    Some where Josepino had mentioned on his site that he had used Roman Black's one_sec.asm routine in his clocks (maybe he mentioned this by accident).
    I tried making a similar program in PBP but had no success, till now.
    Finally i got the progam running. its the exactly same one_sec.asm routine running with instant interrupts, and guess what,... it worked, and really accurately...
    Its even more accurate than the Elapsed Timer...
    I'll post the code so that it may be useful for someone...
    (I'm not as mean and selfish as Josepino...
    and thanks a lot for the instant interrupts program...
    Chiao...

  8. #8
    SelfishJosePino's Avatar
    SelfishJosePino Guest


    Did you find this post helpful? Yes | No

    Talking No, It wasn't an accident.

    No, I didn't mention the Roman Black's web page by accident.

    I good to know there is people not mean and selfish like JosePino. Anyway, I found quite interesting this forum.

    Regards,
    Jose Pino
    www.josepino.com

    Quote Originally Posted by shahidali55
    Hi Darrel,
    Some where Josepino had mentioned on his site that he had used Roman Black's one_sec.asm routine in his clocks (maybe he mentioned this by accident).
    I tried making a similar program in PBP but had no success, till now.
    Finally i got the progam running. its the exactly same one_sec.asm routine running with instant interrupts, and guess what,... it worked, and really accurately...
    Its even more accurate than the Elapsed Timer...
    I'll post the code so that it may be useful for someone...
    (I'm not as mean and selfish as Josepino...
    and thanks a lot for the instant interrupts program...
    Chiao...

Similar Threads

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

Members who have read this thread : 3

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