View previous topic :: View next topic |
Author |
Message |
BLL
Joined: 11 Nov 2006 Posts: 181 Location: Birmingham, UK
|
DS1302 battery charging |
Posted: Sat Nov 11, 2006 2:04 pm |
|
|
Hi,
I have been looking at the data sheet for the 1302 as I want to enable trickle charging with 1 diode and the 4K resistor. How can I do this with the DS1302.c routines, please?
It seems that the control code would be 0x91 and the data 0xA6 but I'm not sure!!
Thanks
Brian |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Nov 11, 2006 11:32 pm |
|
|
Quote: |
I want to enable trickle charging with 1 diode and the 4K resistor.
How can I do this with the DS1302.c routines, please ? |
Look at the init routine in the DS1302.c driver file. It's already doing
what you want. The address is 0x90, because you want to write to
the Trickle Charge register. The data is 0xA6, which is for one diode
with a 4K resistor. Just call the rtc_init() function at the start of your
program and it will set it up exactly as you want it.
Quote: | void rtc_init() {
BYTE x;
output_low(RTC_RST);
delay_us(2);
output_low(RTC_SCLK);
write_ds1302(0x8e,0);
write_ds1302(0x90,0xa6);
x=read_ds1302(0x81);
if((x & 0x80)!=0)
write_ds1302(0x80,0);
} |
|
|
|
BLL
Joined: 11 Nov 2006 Posts: 181 Location: Birmingham, UK
|
DS1302 charging |
Posted: Sun Nov 12, 2006 2:43 am |
|
|
Hi,
Thanks very much for the confirmation. I will go and try it.
Brian
|
|
|
|