Shop OBEX P1 Docs P2 Docs Learn Events
DS1302 on battery or super cap backup — Parallax Forums

DS1302 on battery or super cap backup

John JenkinsJohn Jenkins Posts: 12
edited 2008-06-27 07:25 in BASIC Stamp
I have a DS1302 in a project. Everything works perfectly, except that when power is removed from the system, and then restored, the clock begins counting at the time when power was removed. i.e. even though the DS1302 is "backed up" with a supercap or a battery (I've tried both, connected as per the datasheet) it doesn't continue to keep time when VCC2 is removed. From everything I have read in the datasheet and in the forums, I believe the chip should continue to count time when running on power from VCC1, rather than just starting up again at the last time when it had power from VCC2. · Is that correct?· If so, any idea what I'm doing wrong?

Thanks!

Comments

  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2008-06-27 05:47
    John Jenkins,

    What does your code look like? You have to tell the DS1302 how you want it to "trickle charge".

    See page 7 and page 9 of the datasheet.... http://pdfserv.maxim-ic.com/en/ds/DS1302.pdf


    To confirm your code setup, try connecting the Anode of a small low current (2mA) LED to Vcc1 instead of your battery/capacitor while connecting the Cathode of the LED to GND to make sure the code is indeed doing what you want it to do.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.

    Post Edited (Beau Schwabe (Parallax)) : 6/27/2008 5:56:51 AM GMT
  • John JenkinsJohn Jenkins Posts: 12
    edited 2008-06-27 07:25
    You are absolutely right!·
    I added the following code (included for others who might have this problem) and that did the trick. Now it works perfectly.

    Thanks Beau!

    ' enable trickle charger for 1 diode, 2K ohm resistor
    HIGH CS1302 ' Ready for transfer
    SHIFTOUT DataIO, CLOCK, LSBFIRST, [noparse][[/noparse]$8E, $0] ' Enable write, control = 0
    LOW CS1302 ' Reset RTC
    HIGH CS1302 ' Ready for transfer
    SHIFTOUT DataIO, CLOCK, LSBFIRST, [noparse][[/noparse]$90,$A5] 'Write trickle = %10100101
    LOW CS1302
Sign In or Register to comment.