Shop OBEX P1 Docs P2 Docs Learn Events
Saving a timestamp from the DS1302 — Parallax Forums

Saving a timestamp from the DS1302

pcrobotpcrobot Posts: 103
edited 2006-08-16 17:38 in BASIC Stamp
Hello,

I'm trying to figure out how to save a timestamp from the DS1302 chip. The program to run the clock uses a lot of GOSUBS, which makes it harder to do this, IMO.

Also, for clarity, is the program (the third one in the DS1302's AppKit PDF) supposed to update the debug window? Mine doesn't seem to do that.

Thanks!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.x3beta.forumup.com

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-08-05 17:53
    Hello,

    ·· Using the DS1302 in datalogging is pretty painless.· How to store the data depends really on which data you need.· Do you needs hours, minutes and seconds?· Is your datalogging event-related/driven or is it interval-related/driven?· If the later you don't need to store the date and/or time for each sample, only the first, since the others will always be the same time apart and can be easily recalculated.· If the logging is event driven then you need to know over how much time you will log data to decide what timing information is relevant.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • pcrobotpcrobot Posts: 103
    edited 2006-08-05 20:27
    All I need to do is record the time and date (minute, hour, day and month) a sensor is tripped. I only need to save 10 timestamps or so.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.x3beta.forumup.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-08-06 04:46
    pcrobot,

    ·· There is some DS1302 Demo Code in the Completed Projects Forum.· Using the subroutines in that you could simply call the Get_Time routine (which will also grab the date) and store the variables in EEPROM.· Each one will take one byte, so assuming your sensor data is one byte that's 5 bytes you need to store.· Depending on how many events maximum you expect you can allocate space for storage.

    http://forums.parallax.com/showthread.php?p=531080

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • pcrobotpcrobot Posts: 103
    edited 2006-08-11 18:03
    OK, after I set the date/time (in DS1302_Demo.bs2) I reset the stamp to go back to the menu butwhen I display the time it's all 00:00 00:00. What's wrong?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.x3beta.forumup.com
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-08-11 18:34
    pcrobot -

    I don't know how you "reset the stamp" but if it involved shutting the power off, and you don't have a back-up batttery installed on the DS1602, that's exactly what you can expect.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • pcrobotpcrobot Posts: 103
    edited 2006-08-11 18:55
    Bruce Bates said...
    pcrobot -

    I don't know how you "reset the stamp" but if it involved shutting the power off, and you don't have a back-up batttery installed on the DS1602, that's exactly what you can expect.

    Regards,

    Bruce Bates
    Well if you run the program, it says to reset the Stamp to return to the menu. I wondered why, but that's what it says... confused.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.x3beta.forumup.com
  • Tom WalkerTom Walker Posts: 509
    edited 2006-08-11 18:57
    I think that what Bruce was getting at is that there are other ways to reset the Stamp without disconnecting the power.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...
  • pcrobotpcrobot Posts: 103
    edited 2006-08-11 19:08
    Tom Walker said...
    I think that what Bruce was getting at is that there are other ways to reset the Stamp without disconnecting the power.
    Really? How can you do that?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.x3beta.forumup.com
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-08-11 19:27
    pcrobot -

    You can RESET the Stamp by bringing the RES pin (pin 22) low, or by cycling the power (OFF then ON) to the Stamp ONLY. Cutting the power to everything will RESET the Stamp, but it will reset everything else as well.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-08-11 21:25
    Many of our development boards have a RESET button on them.· That is what you need to press.· If you don't have one you could carefully short the RESET pin on the Stamp Module to Vss (Ground), or build the backup battery circuit so the DS1302 keeps going when power is off.· Are you turning the poewr off?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • pcrobotpcrobot Posts: 103
    edited 2006-08-12 15:19
    I was pushing the reset button. It still doesn't have a date or time...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.x3beta.forumup.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-08-13 02:48
    Sounds like it's not connected as per the schematic then, since the code and schematic are tested to be working.· I would recommend re-checking your connections.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Harry CallahanHarry Callahan Posts: 6
    edited 2006-08-13 12:52
    A quick look at the PDF in question reveals the following:

    - All references to resetting the chip refer to the DS1302, not the Stamp

    - This document should be reviewed and improved by Parallax. There are several nonsensical/confusing statements that invite misunderstanding. Example on page 2: "Why the power is removed the capacitor/ rechargeable battery will power the DS1302."
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-08-13 21:38
    Harry,

    ·· I don't think you're on the same page.· The PDF you are referring to is already in the process of being re-written.· In the meantime the OP was referred to another link which had more updated information.· Please see one of my first replies.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • pcrobotpcrobot Posts: 103
    edited 2006-08-16 17:38
    Here's the program that I have come up with. (attached) I'm going to recheck my connections and post results.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.x3beta.forumup.com
Sign In or Register to comment.