Shop OBEX P1 Docs P2 Docs Learn Events
Why does my BS2 "lose time" when using big PAUSE values? — Parallax Forums

Why does my BS2 "lose time" when using big PAUSE values?

ChrisOChrisO Posts: 10
edited 2005-07-08 23:00 in BASIC Stamp
I am trying to make my BS2 pause for 2 mins between carrying out a repeating servo action. I used two PAUSE 60000 lines, and it seemed to work, but when I timed it with a stopwatch I found out each cycle was getting longer by first about 3-5 seconds.

Does anyone know why this is happening?

Thanks!

Comments

  • ChrisOChrisO Posts: 10
    edited 2005-07-08 04:56
    I should also note--I am running the BS2 off a 9v 300ma AC adaptor.
  • Philip GamblinPhilip Gamblin Posts: 202
    edited 2005-07-08 05:59
    I believe the internal "clock" is not particularly stable. I know I have seen references to it in the past. Debugging costs a surprising ammount of time.
    I currently have a project timing 3600 sec. hours and though I haven't put a clock on it doesn't seem to be that bad. I'll take a look at it to make sure.
    my Clock looks like this. Maybe the shorter period reduces the accumulation of error? Additionally I know there are temperature stablity issues with the clock/resonator. Hopefully there is a software fix.
    main
    high 1
    pause 500
    low 1
    pause 500
    increment counter
    goto main

    There is also the possibility of a real time clock. Pocketwatch B, DS1302 etc.

    Post Edited (Philip Gamblin) : 7/8/2005 6:18:35 PM GMT
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-07-08 18:19
    You may consider an external clock- although at 2min I don't think you should have that much drift....check your code for timing issues...

    Ryan
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-07-08 18:46
    Yup, a DS1302 with 32Khz clock crystal and 2032 watch battery is not expensive, is reasonably simple to interface, and (depending on the crystal) can keep good time.
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-07-08 23:00
    In re-reading the original post: does the cycle time increase EVERY ITERATION?

    2 to 3 seconds for 2 min drift....if the timing is critical you want an external clock source anyway.

    Ryan
Sign In or Register to comment.