20091112

Square Wave output from DS1307

For the clock that uses DS1307 RTC chip, I want a blinking led for indication of second. So, I have placed a resistor and an LED to pin 7 (SQW/OUT) of the DS1307 like below schematic:


Schematic for Square Wave Output DS1307


With this configuration (hardware+software), the LED was blinking at 1 time/second but the blink pattern was not my expectation. The LED is Off when the clock is updated and it is On at 0.5 second later. Quoted from the Control Register section of the DS1307's Datasheet:

With the square wave output set to 1Hz, the clock registers update on the falling edge of the square wave.

I want the reverse pattern (the LED is On when the time is updated and it is Off at 0.5 second later). So, I will add an invert logic before the LED like:


Invert logic at the output of DS1307
I have a plan to use this square wave output of the DS1307 for generating an interrupt to instruct the MCU to read time from the DS1307 and I will keep in mind that "The clock is updated at the
falling edge of the square wave". The complete clock will be posted here later.