您现在的位置:机电论文网>> 嵌入式系统>> 正文内容

使用DS32x35的8051型微控制器(图)

作者: 来源: 发布时间:2009/9/5 10:39:07  点击数:1001

 

Using a DS32x35 with an 8051-Type Microcontroller

Abstract: This application note describes how to interface the DS32x35 real-time clock with an 8051-type microcontroller. It also provides a schematic of the application circuit and example software code for implementing basic operating routines.

Overview of the DS32x35

The DS32x35 real-time clock (RTC) is a temperature-compensated clock/calendar that includes an integrated 32.768kHz crystal, an I²C interface, and a bank of nonvolatile memory in a single package. The DS32x35's integration of a crystal resonator enhances the long-term accuracy of the device and reduces the piece-part count in a manufacturing line.

The RTC provides seconds, minutes, hours, day, date, month, and year information. The date at the end of the month is automatically adjusted for months with fewer 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. Additionally, the clock provides two programmable time-of-day alarms and a programmable square-wave output.

Interfacing the DS32x35 to a µC

This application note demonstrates how to interface the DS32x35 to an 8051-type microcontroller, such as the DS2250 soft-microcontroller module. Additionally, Figure 1 provides example code, written in C, for implementing basic interface routines, including routines for reading the time and date from the real-time clock (RTC); writing time and date data to the RTC from user entries; writing and reading data to and from the FRAM; reading the temperature from the temperature sensor; and selecting the proper FRAM density. The software supports both FRAM densities: 16kb (DS32B35) and 64kb (DS32C35).

Figure 2 is a schematic that illustrates the connections required for interfacing the DS32x35 RTC with an 8051-type microcontroller. The program uses two general-purpose (GP) port pins on the microcontroller to communicate with the DS32x35 using an I²C serial interface; a third GP port pin is used to enable or disable the write-protect (WP) input pin for the FRAM. The microcontroller's internal UART drives two port pins, which are connected to a DS232 line driver/receiver. User inputs and data outputs from the program are passed through the RS-232 interface from a PC's terminal-emulator program to the microcontroller. The RS-232 DTR input line controls the microcontroller's reset input.

Figure 1. Program Listing.
Download (TXT, 11.5kB)
Figure 1. Program Listing

Figure 2. A schematic illustrating the connections for interfacing the DS32x35 with an 8051-type microcontroller.
More detailed image (PDF, 260kB)
Figure 2. A schematic illustrating the connections for interfacing the DS32x35 with an 8051-type microcontroller.

 


更多
字体:【小】-【中】-【大】【关闭此页】

上一篇:DS1685/87和DS17X85/'   下一篇:嵌入式安全系统的发展趋势(图)'


特别声明:机电之家(http://www.jdzj.com )所共享的机电类资料,机电论文、机电类文章、机电企业类管理制度、机电类软件都来自网上收集,其版权归作者本人所有,如果有任何侵犯您权益的地方,请联系我们,我们将马上进行处理。购买的论文都出自原创,保证作者的原创的版权的转让,任何纠纷由法律解决。