CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

DS1302 battery charging

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
BLL



Joined: 11 Nov 2006
Posts: 181
Location: Birmingham, UK

View user's profile Send private message

DS1302 battery charging
PostPosted: Sat Nov 11, 2006 2:04 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Nov 11, 2006 11:32 pm     Reply with quote

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

View user's profile Send private message

DS1302 charging
PostPosted: Sun Nov 12, 2006 2:43 am     Reply with quote

Hi,

Thanks very much for the confirmation. I will go and try it.

Brian

Very Happy
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group