Im trying to use the SQW output from a ds1307 to trigger a interrupt routine but I cant get the chip to produce the signal.
According to the datasheet the SQW is enabled by setting it 4 of register 07h which I have done with;
But I cant get a signal generated. I know the pin and ISR are configured correctly as I can get the ISR to work with a switch connected.
The write_ds1307() routine is;
and is working fine to update the time.
According to the datasheet the SQW is enabled by setting it 4 of register 07h which I have done with;
C:
write_ds1307(0x00, 0x00); // Clock enabled
write_ds1307(0x07, 0b00010000); // SQW output ON 1hz signal
But I cant get a signal generated. I know the pin and ISR are configured correctly as I can get the ISR to work with a switch connected.
The write_ds1307() routine is;
C:
void write_ds1307(unsigned short address, unsigned short w_data) //call this function to write date and time
//to the date and time registers.
{
StartI2C(); // Start condition I2C on bus
IdleI2C();
WriteI2C(0xD0); // addresses the chip
IdleI2C();
WriteI2C(address); // write register address
IdleI2C();
WriteI2C(w_data); // write register address
IdleI2C();
StopI2C(); // Stop condition I2C on bus
}