DS1302 is a high-performance, low-power, real-time clock with RAM circuit what is launched by DALLAS company. It can timing with the year, month, day, hours, minutes, seconds and week . And it's with leap year compensation function. The operating voltage of DS1302 is 2.5V ~ 5.5V.
DS1302 uses a three-wire synchronous communication to interface with the CPU, and using the burst mode transmit the clock signal of the plurality of byte or RAM data. DS1302 within a 31 × 8 RAM registers used for temporary storage of data. The DS1302 is the upgrade product of DS1202. DS1302 is compatible with the DS1202 but adds dual power pins of the main power / backup power supply, while providing a trickle current charge capacity of backup power.
DS1302 Register
DS1302 has 12 registers. 7 of them relate with calendar and clock, their data bits stored in BCD format.
Furthermore, DS1302 has year register, control register, charge register, clock burst register and the RAM register. Clock burst register can be a one-time sequential read and write addition to charging registers outside all register contents. DS1302 and related RAM registers are divided into two categories: one is a single RAM cell 31, each unit is configured as an 8-byte and the command control word is C0H ~~ FDH which an odd number for the read operation, even number of writes; other type of RAM registers is in burst mode, this way can be a one-time read and write all 31 bytes of RAM, the command control word is FEH (write), FFH (read).
DS1302 real time hardware and software
The connection of DS1302 and CPU requires three lines, i.e. SCLK (7), I / O (6), RST (5)