[SOLVED]Not getting square wave output from SQW pin of DS1307

Hi everyone,
I am working on a project which requires an interrupt every 1 second,and it has DS1307 for other uses also. So I decided to use the square wave output of 1Hz from the DS1307. The problem is I am not getting any oscillations in that pin the DS1307 simply pulls the pin down and hence it is at 0V, I tried writing and reading time from the DS1307 with the example sketches of DS1307 library, it functions normally. Do I have to enable the square wave output explicitly by program?(The datasheet says it all).

The SQW pin is an open collector output so do you have a pull up resistor on it?

On page 9 of the Maxim datasheet it shows the register which has the square wave enable bit that needs to be set.

saravananm92:
Do I have to enable the square wave output explicitly by program?(The datasheet says it all).

Yes you need to enable it in the control register. Bit 4 is SQWE (square wave enable) and bits 0-1 are the frequency required. For what you want bits 0 & 1 need to be cleared and bit 4 needs to be set. Any good RTC library will have functions to do this, what library are you using?

I have connected a pullup resistor of 10KOhm from pin7 to VCC.
I am using the library written by alvarojustenhttp://forum.arduino.cc/index.php/topic,59256.0.html.
The catch is that I have seen the square output from the pin7 before without modifying the example programs.
So oi is probable that problem might be in hardware,can anyone suggest the possible faults that may lead to this problem?

Its ok now. I uploaded a custom code to the enable SQW OUT, and it is working perfectly. :slight_smile:

saravananm92:
I have connected a pullup resistor of 10KOhm from pin7 to VCC.
I am using the library written by alvarojustenhttp://forum.arduino.cc/index.php/topic,59256.0.html.

That RTC library is very basic. I recommend this library as it's served me well over the years and has built in SQW commands.