Interfacing a DS1305 RTC with an \r\n8051-Type Microcontroller


This application note describes how to interface a DS1305 real-time clock with the DS2250, an 8051-type microcontroller. Example code, written in C, shows basic interface routines.

DS1305 Pin Assignment

DS1305 Pin Assignment


This application note demonstrates how to interface a DS1305 Serial Alarm Real-Time Clock (RTC) to an 8051-type microcontroller. Example code shows basic interface routines. The microcontroller used in this example is the DS2250 Soft Microcontroller Module, and the software is written in C. The program demonstrates setting and reading the time and date, writing and reading the RAM, and setting and reading an alarm.


The interface program uses three general-purpose port pins (GPIOs) on the microcontroller and the 3-wire interface to communicate with the DS1305 real-time clock. An additional port pin is used to monitor the INT0 interrupt output on the DS1305.

The software is shown in Figure 1. A schematic of the circuit is shown in Figure 2.

Download zip file
Figure 1. Interface Program Listing

Figure 2. Schematic of DS1305.

Figure 2. Schematic of DS1305.
For Larger Image