Elapsed Timer Demo


Closed Thread
Results 1 to 40 of 112

Hybrid View

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

  2. #2


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

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


    Did you find this post helpful? Yes | No

    Default

    shahidali55,

    Pardon my stubborness!
    Sometimes I get so defensive, I don't recognize when someone knows better.

    I've tried your code, and there's definately a big difference.

    But now, I must know how much, and more importantly why.

    Fortunately, with Instant Interrupts, it was easy to combine both timers into one program, and I'm running it on a telnet server, in case you (or anyone else) wants to see too.   I started the test at 12:15 am PST, and have set the time as close as possible relative to GMT. This screen capture was 30 seconds later.




    If you have Hyperterminal installed you can see the results by using the TimerTest.ht file in the .zip below. Hopefully in a few days the error will be more evident. T1 is the Elapsed timer, and T0 is your new timer.

    password: guest
    then type data and press enter
    <br>
    Here's a reference time http://nist.time.gov/timezone.cgi?Pacific/d/-8/java
    Although i started about 1/2 second late.
    <br>

    Test completed. .zip file removed.
    Last edited by Darrel Taylor; - 28th June 2006 at 06:53. Reason: Removed zip
    DT

  4. #4


    Did you find this post helpful? Yes | No

    Talking Problems

    Hello, I have not managed to compile I cosay give errors me, can help me please.

    Thanks

    Leonard



    Quote Originally Posted by Darrel Taylor
    shahidali55,

    Pardon my stubborness!
    Sometimes I get so defensive, I don't recognize when someone knows better.

    I've tried your code, and there's definately a big difference.

    But now, I must know how much, and more importantly why.

    Fortunately, with Instant Interrupts, it was easy to combine both timers into one program, and I'm running it on a telnet server, in case you (or anyone else) wants to see too. &nbsp; I started the test at 12:15 am PST, and have set the time as close as possible relative to GMT. This screen capture was 30 seconds later.



    If you have Hyperterminal installed you can see the results by using the TimerTest.ht file in the .zip below. Hopefully in a few days the error will be more evident. T1 is the Elapsed timer, and T0 is your new timer.

    password: guest
    then type data and press enter
    <br>
    Here's a reference time http://nist.time.gov/timezone.cgi?Pacific/d/-8/java
    Although i started about 1/2 second late.
    <br>

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


    Did you find this post helpful? Yes | No

    Exclamation

    Hi Leonard,
    To compile this code you need to have Darrel's Instant interrupt file (DT_INTS-14.bas) in the folder along with the source code...
    You also need to have enabled the "Use MPASM" option in the compile and options menu...

  6. #6


    Did you find this post helpful? Yes | No

    Talking No found DT_INTS-14.bas

    Hello,

    Don't I find the "DT_INTS-14.bas" in none of the folders, can send it please to my mail?. [email protected]

    Thank you


    Quote Originally Posted by shahidali55
    Hi Leonard,
    To compile this code you need to have Darrel's Instant interrupt file (DT_INTS-14.bas) in the folder along with the source code...
    You also need to have enabled the "Use MPASM" option in the compile and options menu...

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


    Did you find this post helpful? Yes | No

    Exclamation

    Hmmm,

    I fully expected the test to show that the new timer would keep accurate time and give a good indication how far off the Elapsed Timer was, but instead after 24hrs, the Elapsed Timer (T1) was still within 1 second of actual time, and the new timer (T0) had gained almost 8 seconds. Also, my PC's clock was 3 seconds slow. (interesting, but not relevant)<br>
    <br>
    Since then, I've turned Roman's routine into a subroutine and ran it in loops just to verify it's counting, and can say that it does accuratly count 1 million instructions per second. &nbsp; Well, actually, it counts 3 seconds at 999,936 instructions and every 4th second at 1,000,192. Which over the 4 seconds averages out to exactly 4,000,000 instructions. So in a perfect world, with a 4.000000mhz crystal, it should count perfect time. But it doesn't. (in my case)

    This leads me to beilieve that My crystal is off.
    So, continuing with with the perfect world theory...

    There's 86,400 seconds per day
    or 86,400,000,000 instructions per day

    an additional 8 seconds is 8,000,000 instructions
    for a total of 86,408,000,000

    that divided by the 86,400 seconds per day gives
    1,000,092.593 instructions per day or a freq. of
    4,000,370.37 hz.

    That's 93PPM off center frequency. So I've either got a crystal that's almost twice the tolerance. OR I'm still missing something big time.
    <br>
    DT

  8. #8
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Darrel,
    This may be stating the obvious, but either:
    1) Both timer routines are accurate (Definitely not true)
    2) T0 is accurate, T1 is not
    3) T1 is accurate, T0 is not
    4) Neither timer routine is accurate (if your Xtal is within specs and running fast, T0 runs fast and T1 runs slow, this could explain the results you have shown)

    The Xtal error needs to be eliminated to see what’s happening with the last three. One suggestion may work. If you have a RTC handy that will output the 32768Hz, use this as an input to the timers. Then, you can compare the PIC clocks against RTC, all of which would be running at the same exact freq. Some tweeking of the code will be required for this. Also, This may lead to changes in the code which would mask the errors occurring with the 4Mhz Xtal, but it may be worth a try.
    I have actually done this with a timer routine similar to the Elapsed timer, and it works fine. I will add it to this post when I get back to my home computer (Found it! Elapsed_Timer_INT_32.bas.txt). It has some significant differences though. It never stops the timer, only adds to the TMRxH byte, and counts 128 "ticks" per second. (edit: I also count DOWN. I think this added some efficiency with the ASM, but can't remember off the top of my head. It's run on an 18F4620)

    The other is to get a measure of the actually freq of your crystal, then factor this into the timer errors. And I am not sure how to do this to the accuracy needed to find the problem.

    Intriguing problem,
    Steve
    Last edited by SteveB; - 22nd June 2006 at 20:39.

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

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


    Did you find this post helpful? Yes | No

    Smile

    ......................
    Last edited by shahidali55; - 9th July 2006 at 16:34.

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


    Did you find this post helpful? Yes | No

    Arrow Hello Jose Pino,

    Hello Jose Pino,
    I found your LED and LCD clock projects very interesting...
    Why dont you put your source codes online??? Its not like everyone is looking to make money by selling your codes or something...
    Most of them, like me, just want to learn more in this wonderful world of microcontrollers!!!

  12. #12
    SelfishJosePino's Avatar
    SelfishJosePino Guest


    Did you find this post helpful? Yes | No

    Default Microcontroller Projects

    About one year and half ago, I was so mad and upset when I found some of my projects were used for commercial applications on Europe, specifically on Germany. After that, I decided not to post source codes and protect it with copyrights and patents.

    Later, I started to receive some hate mail (Specially from Spanish-speaking readers) accusing me that my projects are stealed from other web pages, so I started to post algorithms of my projects. (only some of them)

    Now, I receive many e-mails from hungy-of-knowledge people over the world asking me for source codes. At this point, I'm thinking seriously to make the source code available to the public.

    As you can see, Is really hard to make everybody happy. So, I guess the best thing to do is to make the source code available for everybody. It may take a while until I have some time available to find the source code and put it online.

    Regards,

    Jose Pino
    www.josepino.com

    Quote Originally Posted by shahidali55
    Hello Jose Pino,
    I found your LED and LCD clock projects very interesting...
    Why dont you put your source codes online??? Its not like everyone is looking to make money by selling your codes or something...
    Most of them, like me, just want to learn more in this wonderful world of microcontrollers!!!

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


    Did you find this post helpful? Yes | No

    Post

    Hello Josepino,

    It'll be great if you put your souce codes online...
    Thanks for considering my posts...

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 : 4

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