Shop OBEX P1 Docs P2 Docs Learn Events
Timer vs clock — Parallax Forums

Timer vs clock

AImanAIman Posts: 531
edited 2006-12-18 16:54 in BASIC Stamp
If I know when I want a buzzer to sound and know that it will happen at the same time every day can I run a timer instead of a clock?

Example
1000 = 1 second
60000=1 minute
86400000 = 24 hours

Loop until the correct counter is reached

Do while counter >= 24hours
puase 1000
Loop

Would that create the same effect as hooking up a clock and saying at 8 am beep? In otherwords an oversimplyfied alarm clock?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-12-15 17:23
    The time would tend to drift from week to week. The PAUSE statement is quite accurate and, with a pause of 1 second, any error from the interpreter's overhead in doing the looping instructions would be small. The Stamp uses a resonator which is not as accurate or as stable as a good crystal, so that would create some error as well. Both crystals and ceramic resonators are also temperature sensitive. If the room temperature is fairly stable, that's not much of an issue.

    So, if your program indeed spends most of its time in the PAUSE statements, it should be fairly accurate over moderate stretches of time (days to weeks), but will probably need calibration and compensation because of accuracy limitations of the resonator.
  • AImanAIman Posts: 531
    edited 2006-12-18 16:54
    I was thinking of making an alarm clock the simplest way possible, however it is very apparent that with the constant need to correct/re-correct regularrly that would be annoying.

    Getting the time keeping chip would be easier.



    Thanks.
Sign In or Register to comment.