Shop OBEX P1 Docs P2 Docs Learn Events
Real Time from PC to DS1302 — Parallax Forums

Real Time from PC to DS1302

Andy McLeodAndy McLeod Posts: 40
edited 2006-10-12 01:29 in BASIC Stamp
Greetings. Now that I have the DS1302 talking and timing properly with the BS2pe, I need to establish syncronized time with a PC. Has anyone an idea of how to make a system call to a PC from the BS2pe and insert that result into Jon Williams ds1302.bs2 code for a time reference, and then run his code?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-10-11 22:43
    Jon wrote an article on communication between a PC and a Stamp as part of the Nuts and Volts series. You would have to write a program for the PC in some programming language that has access to the COM ports. The Stamp program would send a request to the PC in the form of some specific character sequence using a SEROUT statement. The PC program would see that request on the COM port, do the system call to get the time and date, format it in a form easily handled by the Stamp and the DS1302, and send that back to the Stamp using a serial connection to be received with a SERIN command.
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2006-10-11 22:49
    If you install StampPlot Pro, you can make your serial connection and retrieve the time via StampPlot.

    DEBUG "!READ (HH)",CR ' returns current value of 24-hour time for hours
    DEBUGIN DEC hour
    DEBUG "!READ (MM)",CR ' .... minutes
    DEBUGIN DEC Min
    DEBUG "!READ (SS)",CR ' ... seconds
    DEBUGIN DEC Sec

    Of course, be careful of seconds rolling over and changing minutes. You can request and parse a more complex string
    DEBUG "!READ (HH),(MM),(SS)",CR
    Rest is up to you [noparse]:)[/noparse]

    http://www.stampplot.com

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Martin Hebel
    Personal Links with plenty of BASIC Stamp info
    StampPlot - Graphical Data Acquisition and Control
    AppBee - XBee ZigBee / IEEE 802.15.4 Adapters & Devices
  • Andy McLeodAndy McLeod Posts: 40
    edited 2006-10-12 00:27
    Mike Green said...
    Jon wrote an article on communication between a PC and a Stamp as part of the Nuts and Volts series. You would have to write a program for the PC in some programming language that has access to the COM ports. The Stamp program would send a request to the PC in the form of some specific character sequence using a SEROUT statement. The PC program would see that request on the COM port, do the system call to get the time and date, format it in a form easily handled by the Stamp and the DS1302, and send that back to the Stamp using a serial connection to be received with a SERIN command.

    Thank you, Mike. I think this is the most promising idea. i'll give it a try and let you know what happens.
  • Andy McLeodAndy McLeod Posts: 40
    edited 2006-10-12 00:29
    Mike Green said...
    Jon wrote an article on communication between a PC and a Stamp as part of the Nuts and Volts series. You would have to write a program for the PC in some programming language that has access to the COM ports. The Stamp program would send a request to the PC in the form of some specific character sequence using a SEROUT statement. The PC program would see that request on the COM port, do the system call to get the time and date, format it in a form easily handled by the Stamp and the DS1302, and send that back to the Stamp using a serial connection to be received with a SERIN command.

    By the way, do you have a link to Jon's article?
  • Mike GreenMike Green Posts: 23,101
    edited 2006-10-12 00:41
    Andy,
    No. It doesn't take too long to go back through the back-issue list for the titles of the articles. Often I'll spot something to come back and look at later.
    Mike
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2006-10-12 00:59
    Ok, I have to chuckle, the most promising idea is to write some program in some language to parse the time and access the serial port, over a ready made program to help which is free for use, lol.

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Martin Hebel
    Personal Links with plenty of BASIC Stamp info
    StampPlot - Graphical Data Acquisition and Control
    AppBee - XBee ZigBee / IEEE 802.15.4 Adapters & Devices
  • Andy McLeodAndy McLeod Posts: 40
    edited 2006-10-12 01:25
    Martin Hebel said...
    Ok, I have to chuckle, the most promising idea is to write some program in some language to parse the time and access the serial port, over a ready made program to help which is free for use, lol.

    -Martin

    Good point, but my application has an on-PC component to which I can add the system call and serial access.
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2006-10-12 01:29
    Ahhhhhhh, quitting chuckling [noparse]:)[/noparse]
    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Martin Hebel
    Personal Links with plenty of BASIC Stamp info
    StampPlot - Graphical Data Acquisition and Control
    AppBee - XBee ZigBee / IEEE 802.15.4 Adapters & Devices
Sign In or Register to comment.