The STAMP generates the serial stream to the debug window. You would need a real time clock somewhere in the loop. The RTC could be connected to the STAMP or the STAMP could get the time form another system that has a clock..
Per the replies here, there's no built-in RTC in a Stamp. You can fake a clock by writing a program with multiple nested pauses and DEBUG statements. With patience, you can get it reasonably accurate for a while, but it will eventually drift since there is no thermal compensation.
I had a feeling of that. I couldn't find any commands relating to time display, so I figured I would have to add a circuit. Thank you all for your help.
My plan is to have the time displayed on the debug screen when an event is triggered ( servo spins, RFID card is swiped, programmer's wife starts nagging, etc). I looked at the DS1302 and will be picking up one as well as the 32.768 KHz crystal.
I built an electromechanical gizmo for a friend that goes off every hour, like a clock chiming. I used a $10 wristwatch with a "chime" function. The voltage to the piezo beeper was high enough to trigger the input pin on the EMC uC that runs the whole sequence. It's running strong 3 years later, same watch battery, and the accuracy is incredible, it's always within a few seconds of my computer's internet time. I've considered using that hourly chime method to recalibrate a Stamp software clock every hour. It would be easy to write a clock program that wouldn't drift more than a few seconds per hour, and that error goes away every hour. Food for thought.
Comments
I think you might want to hook up a DS1302 Timekeeping Chip.They sell them in the Parallax store.
They are inexpensive and easy to use. If you use a battery with it, it will remember the time. (There is a battery charging circuit built in.)
Good Luck!
http://cgi.ebay.com/2-ROUND-CLOCK-STICK-RED-BLUE-WHITE-GREY-/180593298984?pt=LH_DefaultDomain_0&hash=item2a0c330e28
My plan is to have the time displayed on the debug screen when an event is triggered ( servo spins, RFID card is swiped, programmer's wife starts nagging, etc). I looked at the DS1302 and will be picking up one as well as the 32.768 KHz crystal.
' Example Program: Parallax, ClockApp.bs2 ' Display elapsed time with BS2 and Parallax Serial LCD. ' {$STAMP BS2} ' Stamp directive ' {$PBASIC 2.5} ' PBASIC Directive hours VAR Byte ' Stores hours minutes VAR Byte ' Stores minutes seconds VAR Word ' Stores 1/10 seconds SEROUT 14, 84, [22, 12] ' Start LCD & clear display PAUSE 5 ' Pause 5 ms for clear display SEROUT 14, 84, ["Time Elapsed...", 13] ' Text + carriage return SEROUT 14, 84, [" h m s"] ' Text on second line DO ' Main routine ' Calculate hours, minutes, seconds IF seconds = 60 THEN seconds = 0: minutes = minutes + 1 IF minutes = 60 THEN minutes = 0: hours = hours + 1 IF hours = 24 THEN hours = 0 ' Display digits on LCD on line 2. The values 148, 153, 158 ' place the cursor at character 0, 5, and 10 for the time values. SEROUT 14, 84, [148, DEC2 hours,153, DEC2 minutes,158, DEC2 seconds ] PAUSE 991 ' Pause + overhead ~ 1 second seconds = seconds + 1 ' Increment 1/10 second counter LOOP ' Repeat main routine