Shop OBEX P1 Docs P2 Docs Learn Events
Ds1302 with backup power supply — Parallax Forums

Ds1302 with backup power supply

ArchiverArchiver Posts: 46,084
edited 2001-03-01 21:17 in General Discussion
Hi everyone. I'm using a BS2 with a ds1302 time chip. In the
example from parallax's web site it states that this chip can be
powered with a cap to retain its time setting. The problem is that
when the circuit loses power and then regains power, the stamp starts
its program from the begining where it intializes the ds1302 with a
certain time. Is there any way for the stamp to detect if the cap
has a charge on it, skip the step that intializes the ds1302 and just
read the present time from the chip.

Thanks,

Charlie

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-03-01 17:36
    Usually a clock chip will revert back to a specific date / time if it loses
    power. Might try finding out what this is and check it when your program
    starts.

    On a side note, we've got a Dallas chip on one of our pieces of equipment at
    work, and it uses a 3v coin cell for power -- lasts about 2 years.

    Original Message


    > Hi everyone. I'm using a BS2 with a ds1302 time chip. In the
    > example from parallax's web site it states that this chip can be
    > powered with a cap to retain its time setting. The problem is that
    > when the circuit loses power and then regains power, the stamp starts
    > its program from the begining where it intializes the ds1302 with a
    > certain time. Is there any way for the stamp to detect if the cap
    > has a charge on it, skip the step that intializes the ds1302 and just
    > read the present time from the chip.
    >
    > Thanks,
    >
    > Charlie
    >
    >
    >
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-01 21:17
    Hi Charlie,
    Here are 2 ways I've done to get around this:
    1) Have a seperate program that just sets the time. Run this, set
    time, then download your real program.
    2) Once time is set, write a value to a memory location. This will
    remain even if power is lost (EEPROM). Before setting time, check
    this memory location to see if has been set yet or not. If not, set
    time, if set, skip set time.
    3) One more option is to get time serially from a com port on a PC,
    a simple program to write out time in Qbasic serially. Then you have
    a way to update it when you need to. An overkill of this and much
    more is done with out BISCIT programs if you need some code to look
    at.
    http://www.selmaware.com/biscit

    -Martin Hebel

    Southern Illinois University Carbondale
    Electronics Systems Technologies
    http://www.siu.edu/~imsasa/elm

    SelmaWare Solutions
    [url=Http://www.selmaware.com/s-plot]Http://www.selmaware.com/s-plot[/url]


    --- In basicstamps@y..., charlieb83@h... wrote:
    > Hi everyone. I'm using a BS2 with a ds1302 time chip. In the
    > example from parallax's web site it states that this chip can be
    > powered with a cap to retain its time setting. The problem is that
    > when the circuit loses power and then regains power, the stamp
    starts
    > its program from the begining where it intializes the ds1302 with a
    > certain time. Is there any way for the stamp to detect if the cap
    > has a charge on it, skip the step that intializes the ds1302 and
    just
    > read the present time from the chip.
    >
    > Thanks,
    >
    > Charlie
Sign In or Register to comment.