DS1302 Back-up Battery Charger
I have been working with a DS1302 and I can't seen to get the coding right to turn off the charging output. I read the data sheet and it states that the output is off by default. However, I somehow got it turned on because I have a output voltage of 1.20v on the back-up pin. I want to be able to turn it off so that I don't have trouble with non-rechargeable batteries. I just need a shove in the right direction. Thanks for any input.
Nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Comments
'
Trickle Charge values
Tric····· CON %10010000
OFF······ CON %11110000 'turns off trickle charge
D1R1····· CON %10100101 '1 diode 1 resistor 0.7v 2k ohms
D1R2····· CON %10100110 '1 diode 2 resistor 0.7v 4k ohms
D1R3····· CON %10100111 '1 diode 3 resistor 0.7v 8k ohms
D2R1····· CON %10101001 '2 diode 1 resistor 1.4v 2k ohms
D2R2····· CON %10101010 '2 diode 2 resistor 1.4v 4k ohms
D2R3····· CON %10101011 '2 diode 3 resistor 1.4v 8k ohms
Temp = D2R3············ ' *** Edit this variable ***
RTCCmd = TRIC
How ever you would be better off to us a ONE FARD Supper Cap work much better I have used both
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
·
·
·
·
Sam
I have tried to use te values you provided. I still can't get it to work. Maybe I'm testing it wrong? I'm testing with a DVM from Vss to pin #8 of the DS1302 with the battery not installed. I thought I was getting 1.20v but as I test more and more I find that the voltage is moving around..... I have seen voltage as high as 4.20v and the lowest I can get now is 1.7 volts. I have stripped the code down to what I believe is the bare minimum to get it to change the charger settings.
' {$STAMP BS2} ' {$PBASIC 2.5} '------- Trickle Charge values --------------------------------------------- Tric CON %10010000 OFF CON %00001111 'turns off trickle charge D1R1 CON %10100101 '1 diode 1 resistor 0.7v 2k ohms D1R2 CON %10100110 '1 diode 2 resistor 0.7v 4k ohms D1R3 CON %10100111 '1 diode 3 resistor 0.7v 8k ohms D2R1 CON %10101001 '2 diode 1 resistor 1.4v 2k ohms D2R2 CON %10101010 '2 diode 2 resistor 1.4v 4k ohms D2R3 CON %10101011 '2 diode 3 resistor 1.4v 8k ohms Temp = D2R2 ' *** Edit this variable *** RTCCmd = TRIC ' -----[noparse][[/noparse] I/O Definitions ]------------------------------------------------- DataIO PIN 0 ' DS1302.6 Clock PIN 1 ' DS1302.7 CS1302 PIN 2 ' DS1302.5 ' -----[noparse][[/noparse] Constants ]------------------------------------------------------- CWPr CON $8E ' Write Protect Register WPr1 CON $80 ' Set Write Protect WPr0 CON $00 ' Clear Write Protect ' -----[noparse][[/noparse] Variables ]------------------------------------------------------- reg VAR Byte ' Read/Write Address ioByte VAR Byte ' Data To/From DS1302 Temp VAR Byte RTCCmd VAR Byte reg = CWPr ' Initialize DS1302 ioByte = WPr0 ' Clear Write Protect HIGH CS1302 ' Select DS1302 SHIFTOUT DataIO, Clock, LSBFIRST, [noparse][[/noparse]reg, ioByte] LOW CS1302 ' Deselect DS1302 HIGH CS1302 ' Select DS1302 SHIFTOUT DataIO, Clock, LSBFIRST, [noparse][[/noparse]%10010000, %00001111] LOW CS1302 ' Deselect DS1302 STOPNick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm concerned that even with a value of %00001111 it should turn off the charging output but I still get a voltage above 1 volt. Maybe it's nothing to be worried about?
Nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The ones that a cordless phone battery pack this is what I would
That why I was saying that I use supper caps
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 3/4/2010 10:33:20 PM GMT