The DS1302 trickle-charge timekeeping chip contains a real-time clock/calendar and 31 bytes of static RAM. It communicates with a microprocessor via a simple serial interface. The real-time clock/calendar provides seconds, minutes, hours, day, date, month, and year information.
The DS1302 trickle-charge timekeeping chip contains a real-time clock/calendar and 31 bytes of static RAM. It communicates with a microprocessor via a simple serial interface. The real-time clock/calendar provides seconds, minutes, hours, day, date, month, and year information. Only three wires are required to communicate with the clock/RAM: CE, I/O (data line), and SCLK (serial clock). Data can be transferred to and from the clock/RAM 1 byte at a time or in a burst of up to 31 bytes. The DS1302 is designed to operate on very low power and retain data and clock information on less than 1μW. The DS1302 has dual power pins, one for primary and another for backup. in this example the Priamry power will be provided by the Arduino, and the back up by a CR2032 battery.
The 31 bytes of RAM is formatted as shown in the table below. Notice that the numeric positions have their own bits to fill. Specifically the 0-9 value of the 'ones' place have 4 bits, and the 0-9 value of the 'tens' place has 3 bits for the byte filled with the seconds value. These values are combined to create the entire byte.