DS1307 1Hz Signal to start an interupt ?

How can i use the 1Hz Signal from the DS1307 RTC to start an interupt on the Arduino 2009 ?

Simple, wire the 1hz output signal to either pins 2 or 3 and use the AttachInterrupt command. Then write a ISR routine to handle the interrupt.

http://arduino.cc/en/Reference/AttachInterrupt

Thanks,

i think you mean something like this:

byte swIn = 2;

void setup()
{
  attachInterrupt(0, Democode, FALLING);
  pinMode(swIn, INPUT);
  digitalWrite(swIn, HIGH);
}

void loop()
{
}

void Democode() // The code for the interrupt
{
  // Code ...
}

How can i set the squarewave-out signal from the ds1307 to 1hz ?
The square-wave frequency could be 1Hz, 4kHz, 8kHz and 32kHz.

You need to write the DS1307 control register using the SDA & SCL lines

"Bit 4: Square-Wave Enable (SQWE). This bit, when set to logic 1, enables the oscillator output. The frequency of the square-wave output depends upon the value of the RS0 and RS1 bits. With the square-wave output set to 1Hz, the clock registers update on the falling edge of the square wave. On initial application of power to the device, this bit is typically set to a 0."

Read the datasheet, looks pretty straightforward.

As a needed addition for the ds1307 library:

ds1307.h:

#define DS1307_SQWE 7 // 07h - squarewave control register

#define DS1307_HI_SQWE B00010000 // SQWE = 1 (enabled), RS1 = 0, RS0 = 0