Ads by Google ► Alarm Clock ► RTC Real Time Clock ► RTC Related Searches: HTML Page Adobe Photoshop Plugins Google Search Appliance New Business Applications Internet Search Engines Internet Search Keyword Research Keyword Analysis Ad Copy Adobe Photoshop Tutorials Plugin For Photoshop
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
The real-time clock (RTC) is a widely used device that provides accurate time and date for many applications. Many
systems such as the x86 IBM PC come with such a chip on the motherboard. The RTC chip in the IBM PC provides
time components of hour, minute, and second, in addition to the date/calendar components of year, month, and day. TheRTC chip uses an internal battery, which keeps the time and date even when the power is off. Although some 8051
family members, such as the DS5000T, come with the RTC already embedded into the chip, we have to interface the
vast majority of them to an external RTC chip. One of the most widely used RTC chips is the DS 12887 from Dallas
Semiconductor/Maxim Corp. This chip is found in the vast majority of x86 PCs. The original IBM PC/AT used theMC14618B RTC from Motorola. The DS 12887 is the replacement for that chip. It uses an internal lithium battery to
keep operating for over 10 years in the absence of external power. According to the DS 12887 data sheet from Maxim,
it keeps track of “seconds, minutes, hours, days, day of week, date, month, and year with leap-year compensation valid
up to year 2100″. The above information is provided in both binary (hex) and BCD formats. The DS 12887 supportsboth 12-hour and 24-hour clock modes with AM and PM in the 12-hour mode. It also supports the Daylight Savings
Time option. The DS 12887 uses CMOS technology to keep the power consumption low and it has the designation
DS12C887, where C is for CMOS. The DS12887 has a total of 128 bytes of nonvolatile RAM. It uses 14 bytes of
RAM for clock/calendar and control registers, and the other 114 bytes of RAM are for general-purpose data storage. Inthe x86 IBM PC, these 114 bytes of NV-RAM are used for the CMOS configuration, where the system setups are kept
before the operating system takes over. Next we describe the pins of the DS 12887. See Figure 16-1.
Vcc
Pin 24 provides external supply voltage to the chip. The external voltage source is +5V. When VC9 falls below the 3V
level, the external source is switched off and the internal lithium battery provides power to the RTC.
This nonvolatile capability of the RTC prevents any loss of data. According to the DS12887 data sheet “the RTCfunction continues to operate, and all of the RAM, time, calendar, and alarm memory locations remain non-volatile
regardless of the level of the Vcc input.” However, in order to access the registers via a program, the Vcc must be
supplied externally. In other words, when external Vcc is applied, the device is fully accessible and data can be written
and read. When Vcc falls below 4.25 volts, the read and write to the chip are prevented, but the timekeeping and RAM
contents are unaffected, since they are nonvolatile. It must also be noted that “when Vcc is applied to the DS12887
and reaches a level of greater than 4.25V, the device becomes accessible after 200ms.”
GND
Pin 12 is the ground. ADO-AD7
The multiplexed address/data pins provide both addresses and data to the chip. Addresses are latched into the DS
12887 on the falling edge of the AS (ALE) signal. A simple way of connecting the DS 12887 to the 8051 is shown inFigure 16-2. Notice that ADO – AD7 of the DS 12887 are connected directly to PO of the 8051 and there is no need
for any 74xx373 latches, since the DS 12887 provides the latch internally. To access the DS 12887 in Figure 16-2, we
use the MOVX instruction since it is mapped as external memory. We will discuss this shortly.
AS (ALE)
AS (address strobe) is an input pin. On the falling edge it will cause the addresses to be latched into the DS 12887. The
AS pin is used for demultiplexing the address and data and is connected to the ALE pin of the 8051 chip.
MOT
This is an input pin that allows the choice between the Motorola and Intel microcontroller bus timings. The MOT pin is
connected to GND for the Intel timing. That means when we connect DS 12887 to the 8051, MOT = GND.
DS
Data strobe or read is an input. When MOT = GND for Intel timing, the DS pin is called the RD (read) signal and is
connected to the RD pin of the 8051.
R/W
Read/Write is an input pin. When MOT = GND for the Intel timing, the R/W pin is called the WR (write) signal and isconnected to the WR pin of the 8051.
CS
Chip select is an input pin and an active low signal. During the read (RD) and write (WR) cycle time of Intel timing, the
CS must be low in order to access the chip. It must be noted that the CS works only when the external Vcc is connected.
In other words “when Vcc falls below 4.25V, the chip-select input is internally forced to an inactive level regardless of the
value of CS at the input pin.” This is called the write-protected state. When the DS 12887 is in write-protected state, all