BS2: Uploading Real-Time Clock Using PC System Time
rjk5
Posts: 3
I have used data acquisition software (Windows 2000/XP) that allows the real-time clock of a data logger to acquire the system time of the serially-connected PC. I am interested in doing the same thing with the Pocket Watch B of my·Stamp 2 project, but I am willing to substitute another real-time clock if necessary. Has anyone successfully maintained the real-time clocks of their stamps through the serial connection with the PC? If so, please advise as I do not wish to reinvent the wheel.
rjk5·
rjk5·
Comments
·
·· In order to accomplish this task the PC will need software running that monitors the serial port for a request from the BASIC Stamp for the time.· It would then reply with the time and/or date information.· You would need to empirically test to determine the lost time in the transfer and account for that as well.· I tend to use the DS1302 in all of my projects because of the wide operating voltage, battery backup and charging circuit, and the RAM which is also backed up.· I hope this helps.· Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
COLOR 14, 11, 1
CLS
INPUT " WHAT COM PORT (1 OR 2)"; X$
IF VAL(X$) = 1 THEN GOTO ONE
IF VAL(X$) = 2 THEN GOTO TWO
ONE:
OPEN "COM1:9600,N,8,1,CD0,CS0,DS0,OP0,TB0,RS" FOR RANDOM AS #1
GOTO START
TWO:
OPEN "COM2:9600,N,8,1,CD0,CS0,DS0,OP0,TB0,RS" FOR RANDOM AS #1
GOTO START
START:
CLS
LOCATE 10, 15
PRINT "THE TIME IS "; TIME$, "THE DATE IS "; DATE$
PRINT #1, MID$(DATE$, 1, 2)
PRINT #1, MID$(DATE$, 4, 2)
PRINT #1, MID$(DATE$, 9, 2)
PRINT #1, MID$(TIME$, 1, 2)
PRINT #1, MID$(TIME$, 4, 2)
PRINT #1, MID$(TIME$, 7, 2)
CLOSE #1
LOCATE 15, 25
PRINT " THE DS1302-RTC HAS BEEN SET "
SLEEP 5
CLS
END
·
·· That could work if the Stamp Module was waiting for those characters that are being sent.· My own thoughts were to leave the PC side program running monitoring the port for a command byte from the PC to get the time and then send it.· You’re also sending the time in this program as a series ASCII characters, whereas it would take less bytes and be easier to deal with if you sent the binary values BCD packed.· This would be 3 bytes for the time, for example.· The method you posted will send 12 bytes total, as far as I can tell.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support