MD_D1307 Real Time Clock Library
1.3
Library to control DS1307 real time clock
|
The library has a simple interface to the RTC hardware implemented through:
The control() and status() methods are the main interface to action setting parameters or status values. The parameters used for each are similar, but not symmetrical, due to the way the hardware is implemented. The table below highlights the combinations of valid parameters for the control() method and whether a parameter can be changed by user code.
The status() method will return the current value from the parameter nominated and is guaranteed to be in the valid set.
Function | R | W | Write value ------------------— |
---|---|---|---|
DS1307_CLOCK_HALT | Y | Y | DS1307_ON, DS1307_OFF |
DS1307_SQW_RUN | Y | Y | DS1307_ON, DS1307_OFF |
DS3231_SQW_TYPE_ON | Y | Y | DS1307_SQW_1HZ, DS1307_SQW_4KHZ, DS1307_SQW_8KHZ, DS1307_SQW_32KHZ |
DS1307_SQW_TYPE_OFF | Y | Y | DS1307_SQW_HIGH, DS1307_SQW_LOW |
DS1307_12H | Y | Y | DS1307_ON, DS1307_OFF |
Reading the current time from the clock is a call to the readTime() method. The current date and time is then available in the interface registers.
Writing the current time is a sequence of writing to the interface registers followed by a call to the writeTime() method.
The DS1307_LCD_Time example has examples of the different ways of interacting with the RTC.