Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Real time clock DS1307 time keeping registers

Status
Not open for further replies.
Now my question is that if we do not give Power 5V to DS1307 but a battery is connected then will it run with Battery Power only

Answer is Yes

If you connected Backup battery then RTC is running internally even power is disconnected
 

I got ur point but nw my question is i have to send packed BCD or unpacked BCD to RTC???
 

nop i m not getting any data..

i have one doubt about CH bit...

Is it necessary to set or clear that particular bit for communication?

if yes then how can i set that particular bit?
 

@JIgnesh : CH bit has to be cleared to Start the Crystal Oscillator connected to DS1307 as this only responsible for DS1307 proper Working
SO in Datasheet you will find it is written there also ,

make a function like to write_DS1307

to clear that pin MASK the 7th bit of 0x00 register of DS1307
Code:
unsigned int first_switch ; 
first_switch =  PORT0&0b00000001;   // mask port0 -0th  bit of Port 0
You can try like this and then make assign "0" to the variable like here first_switch
 

This codes will help you


Code C - [expand]
1
2
3
4
5
6
7
8
9
void I2Cwrite(){
                                        
         I2CStart();                /* Send Start condition */
        I2CSend(0xD0);                /* Send DS1307 slave address with write operation */
        I2CAck_status();
        I2CSend(0x00);                /*Send subaddress 0x00,we are writing to this location */
        I2CAck_status();
        I2CSend(0x80);        //write $80 to REG0. (pause counter + 0 sec)
        I2CAck_status();

 

JIgnesh :

The possibilities of getting such Output are:
1. Either You are not giving Proper Power Supply
2. I2C Reading Function is not working Properly ,

ALSO , For Reading RTC also you have to Clear the CH bit first as I said it will Start The OSCILLATOR but still first that Question MARKs Should be resolved !!
Have you connected Battery there ?
 

Well Done

Share your experience and key points that you have obtained for others
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top