APPLICATION NOTE 3449

Interfacing a DS1302 With an 8051-Type Microcontroller


Abstract: This application describes how to interface a DS1302 RTC using the 3-wire interface to an 8051-type microcontroller. The example includes a schematic and example software written in C.

DS1302 Pin Assignment
DS1302 Pin Assignment

Description

This application note demonstrates how to interface a DS1302 real-time clock to an 8051-type microcontroller and provides example code showing basic interface routines. The microcontroller used in this example is the DS2250, and the software is written in C.

Operation

The program uses three general-purpose port pins on the microcontroller to control the 3-wire synchronous bus. The microcontroller initiates a data transfer by sending a command byte to the DS1302. The microcontroller then sends additional data and/or SCLKs to the DS1302, which transmits or receives data based upon the command byte.

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

Figure 1. Program Listing (Download ZIP file)

Figure 2. Schematic of DS1302 RTC.
For Larger Image

Figure 2. Schematic of DS1302 RTC.

Related Parts
DS1302 Trickle-Charge Timekeeping Chip Free Samples  


Next Steps
EE-Mail Subscribe to EE-Mail and receive automatic notice of new documents in your areas of interest.
Download Download, PDF Format (20kB)  

© Feb 21, 2005, Maxim Integrated Products, Inc.
The content on this webpage is protected by copyright laws of the United States and of foreign countries. For requests to copy this content, contact us.

APP 3449: Feb 21, 2005
APPLICATION NOTE 3449, AN3449, AN 3449, APP3449, Appnote3449, Appnote 3449