It's not really possible to make a real time clock with the Stamp. Even though the Stamp has a crystal based clock that's used for timing in various statements, there's no way to accumulate accurate times. You really need some kind of accurate external time standard. There are several Nuts and Volts Columns downloadable from Parallax on attaching a real time clock to a Stamp.
Depending on what you are looking for, the BASIC Stamp has been used many times for custom Real Time Clocks. Each of the following uses an RTC chip and additional hardware, however it may help you. Take care.
Your post made me curious to play with a simple timing loop on my BS1 Project board today. I wrote the 12-hour timer program below that simply displays H:M:S using the debug command. It could be calibrated over a period of time by tweaking the pause command by trial & error. Or rather, "empirically determining the coefficients of performance." Expanding the program by inserting IF checks would slow it down and require further calibration. Debug is a very slow command, and the actual execution time may vary depending on whether the variables are single- or double-digit. But it may be accurate enough for certain short-term timer applications. BS2-class code could be similarly contrived.
' {$STAMP BS1}
' {$PBASIC 1.0}
start:FOR B0=1 TO 12' hours
FOR B1=0 TO 59' minutes
FOR B2=0 TO 59' seconds
DEBUG # B0,":",# B1,":",# B2,CR
PAUSE 781
NEXT
NEXT
NEXT
GOTO start
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ ·"If you build it, they will come."
I'm not sure how stable the Resonator-based oscillator is over time and temperature and power fluctuations -- that's why a battery-backed 1302 clock chip is so nice.
For a short term clock, there are several Penguin Robot programs
that do counting, timing and remain relatively accurate. The program
statements are timing sensitive so be aware of any mods.
The Brain Timer handles minutes, and Tiny Timer does seconds.
The others are sequential counters that can be modified for time.
These work on Penguin Robot's BS2px-24 microcontroller.
Hi Erco!
thanks for your post!
In my understanding is very difficult to make a RTC with a standard cristal clock, probably for a short term clock could work (i.e. 2 or 3 hours clock), but even calibrating the loops the clock will carry milliseconds (more or less milliseconds) in the minutes, it will carry minutes in a day, and hours in a week, and so on. That´s why all depend of the cristall basically.... best regards...
Comments
http://forums.parallax.com/showthread.php?p=552892
http://forums.parallax.com/showthread.php?p=531080
http://forums.parallax.com/showthread.php?p=625915
http://forums.parallax.com/showthread.php?p=574815
http://forums.parallax.com/showthread.php?p=553075
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
This forum and its people is absolutely·GREAT!
' {$STAMP BS1}
' {$PBASIC 1.0}
start:FOR B0=1 TO 12' hours
FOR B1=0 TO 59' minutes
FOR B2=0 TO 59' seconds
DEBUG # B0,":",# B1,":",# B2,CR
PAUSE 781
NEXT
NEXT
NEXT
GOTO start
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
that do counting, timing and remain relatively accurate. The program
statements are timing sensitive so be aware of any mods.
The Brain Timer handles minutes, and Tiny Timer does seconds.
The others are sequential counters that can be modified for time.
These work on Penguin Robot's BS2px-24 microcontroller.
penguin_tiny_timer.bpx
http://forums.parallax.com/showthread.php?p=677138
penguin_brain_timer.bpx
http://forums.parallax.com/showthread.php?p=686766
penguin_basic_counter.bpx
http://forums.parallax.com/showthread.php?p=691831
penguin_continuous_counter.bpx
http://forums.parallax.com/showthread.php?p=685643
humanoido
thanks for your post!
In my understanding is very difficult to make a RTC with a standard cristal clock, probably for a short term clock could work (i.e. 2 or 3 hours clock), but even calibrating the loops the clock will carry milliseconds (more or less milliseconds) in the minutes, it will carry minutes in a day, and hours in a week, and so on. That´s why all depend of the cristall basically.... best regards...