Software for the DS1302 Real Time Clock

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 end of the month date is automatically adjusted for months with less than 31 days, including corrections for leap year. The clock operates in either the 24-hour or 12-hour format with an AM/PM indicator.

This RTC is the replacement for the eariler DS1202. The DS1302 will work is a circuit designed for a DS1202 and will be able to use DS1202 software, HOWEVER, there can be a problem with battery life when used in a DS1202 circuit. This is the problem:

DS1302 mounted in DS1202 socket DS1302 mounted on FOX11
The photo above is of a DS1302 mounted in the application area of the MC9S12DP256 EVBplus Development board, DRAGON12, from WYTEC. This circuit used the two diode DS1202 type layout. To correct this problem bend up pin 1 and connect it directly to the positive terminal of the battery. (The diode in the photo could have been replaced with a wire jumper.) The photo above is of the DS1302 mounted in the application area of the FOX11 MC68HC11 trainer board from WYTEC. This board has a solderless breadboard mounted above the application area. It must be removed before the DS1302 and other parts are added. The battery part # is CR1225FV available from Mouser Electronics.
Click here to get HC12 software for the DS1302 Click here to get HC11 software for the DS1302
My MC9S08QE64 Miniboard example uses the DS1302 and there is software for it.
Low cost DIP chip from ElectroDragon
DS1302 Real Time Clock Module w/ CR2032 Button Battery from SuntekStore, similar from DX.com

See also my Software for the DS1307 page.

Roger's Embedded Microcontrollers Home Page

This page written by Roger Schaefer. Last updated August 9, 2013