What command is required to activate 1Hz SW for RTC on data logger module

I have got the data logger module which includes the DS1307 RTC which can supply a 1Hz square wave output. I have connected a 10K pullup resistor but need to know what arduino command is needed to enable SQWE (Square Wave Enable): This bit, when set to a logic 1, will enable the oscillator output.

RS0 and RS1 must also be set low by a software command to obtain 1Hz.

Can anyone help me with this? Thanks in anticipation of a reply.

Don

Google is your friend:

Write 0x10 to register 7 to enable square wave out at 1 hz is how I interpret the data sheet.

void sqw() // set to 1 Hz
{
Wire.beginTransmission(DS1307_I2C_ADDRESS);
Wire.write(0x07); // move pointer to SQW address
Wire.write(0x10); // sends 0x10 (hex) 00010000 (binary)
Wire.endTransmission();
}

Thanks, have to go out now will try it later and report back

I think you need 0x80, or 0b10000000.

Bit 7 of Register 0 is the clock halt (CH) bit. When this bit is set to 1, the oscillator is disabled. When cleared to 0, the oscillator is enabled.

Are you reading 9 of 14.

Oops, think I answered the wrong post - writing 0x80 to register 0 enables time counting.
Square wave is a different register, 0x10 to register 7 as pointed out.

I have done that.

I entered the address for DS1307_I2C_ADDRESS as 0x68 as per LarryD code

void sqw() // set to 1 Hz
{
Wire.beginTransmission(0x68);
Wire.write(0x07); // move pointer to SQW address
Wire.write(0x10); // sends 0x10 (hex) 00010000 (binary)
Wire.endTransmission();
}

but could not observe a SW output which remained low. The code uploads OK.
5V was dropped across the pullup resistor.

The RTC part works fine.

Maybe I am missing something here?

but could not observe a SW output which remained low.

How are you trying to observe the square wave output?

Can you provide a sketch of how you wired the pull up resisitor and the relationship to the input pin?

Did you call the sqw() function some where in your sketch?
Yes, we need to see your sketch.

.

Problem successfully solved thanks to all and particularly LarryD as my inexperience with s/w led me to make a fundamental error by not calling the sqw() function which is an inexcusable error.

I observed the waveform both with a CRO and an analog multimeter for faster response.

This is a great forum. Can a photo be included in a post which could be useful for future postings?

cheers

Don

Congrats.
You can attach files by selecting "Attachments an other options"

CRO, :o
Time to get a DSO :wink: