How does one use/control SQW/OUT **(square wave output controller)**of an rtc1307? The data sheet says that when enabled the SQWE pin is set to one, the SQW/OUT outputs 1 of 4 sq. wave frequencies. The frequncy is set by the control register.
Data sheet doesn't explain how this is all done. How does one set set SQWE pin and the control register from an arduino.
I already have a rtc1307 connected to SCL & SDA pins, have the time set on the 1307 and can read correct time/date by serial.read, and can also save time/date to an SD card. I would like to know how to use the SQW/OUT outputs.
Here is data sheet: (http://www.sparkfun.com/datasheets/Components/DS1307.pdf )
Here is code I used for setting and reading time/date from 1307: (RTC1307 - Real Time Clock - Combustory )
Thank you, I will appreciate any help
BTW, RTC stands for 'real time clock', rtc1307 is used to keep time, and can be used to 'stamp' time and date from an external source to Arduino read out data.
Im not very experienced with I2C and Im not sure how to handle those registers.
My suspect is that you must send bytes sequentially to DS1307, in a defined order, to write the info about date/time and the SWQ/OUT.
Seems that SWQ/OUT is the 8th byte you must write to set it.
In this example: (from redirect)
Wire.beginTransmission(0x68); // activate DS1307
Wire.send(0); // where to begin
Wire.send(0x80 | hours); //hours (24hr time)
Wire.send(0x06); // Day 01-07
Wire.send(0x01); // Date 0-31
Wire.send(0x05); // month 0-12
Wire.send(0x09); // Year 00-99
Wire.send(0x10); // Control 0x10 produces a 1 HZ square wave on pin 7.
Sets SWQ/OUT to 1Hz. Probably in the datasheet you can find the right register values for another possible sets: 4kHz, 8kHz and 32kHz.
Hope it helps.