1 Device characteristics
The DS12C887 real-time clock chip has rich functions and can be used to directly replace the clock calendar chip DS12887 on the IBM PC. At the same time, its pins are also compatible with MC146818B and DS12887.
Since DS12C887 can automatically generate time information such as century, year, month, day, hour, minute, and second, a century register is added internally, thereby using hardware circuits to solve the sub-"millennium" problem; DS12C887 has its own lithium battery, and an external When powered off, its internal time information can be maintained for 10 years; for time recording within a day, there are two modes: 12-hour and 24-hour. In the 12-hour clock mode, AM and PM are used to distinguish morning and afternoon; there are also two ways to express time, one is expressed by binary numbers, and the other is expressed by BCD code; DS12C887 has 128 bytes of RAM, of which The 11-byte RAM is used to store time information, the 4-byte RAM is used to store the control information of DS12C887, called the control register, and the 113-byte general-purpose RAM is used by the user; in addition, the user can also program the DS12C887 to implement a variety of square waves output, and its internal three-way interrupts can be shielded through software.
2 pin function
The pin arrangement of DS12C887 is shown in Figure 1. The function of each pin is as follows:
GND, VCC: DC power supply, where VCC is connected to +5V input and GND is connected to ground. When the VCC input is +5V, the user can access the data in the RAM in the DS12C887 and perform read and write operations on it; when the VCC input is less than When +4.25V, the user is prohibited from reading and writing the internal RAM. At this time, the user cannot correctly obtain the time information in the chip; when the VCC input is less than +3V, the DS12C887 will automatically switch the power supply to the internal lithium battery. on the pool to ensure that the internal circuit can work properly.
MOT: Mode selection pin. DA12C887 has two working modes, namely Motorola mode and Intel mode. When MOT is connected to VCC, the selected working mode is Motorola mode. When MOT is connected to GND, the selected working mode is Intel mode. This article mainly discusses Intel mode.
SQW: Square wave output pin. When the power supply voltage VCC is greater than 4.25V, the SQW pin can perform square wave output. At this time, the user can obtain the output of 13 kinds of square wave signals by programming the control register.
AD0~AD7: multiplexed address data bus. This bus adopts time division multiplexing technology. In the first half of the bus cycle, what appears on AD0~AD7 is the address information, which can be used to strobe the RAM in the DS12C887. In the second half of the bus cycle, Part of the data information appearing on AD0~AD7.
AS: Address strobe input pin. During read and write operations, the rising edge of AS latches the address information appearing on AD0~AD7 to the DS12C887, and the next falling edge clears the address information on AD0~AD7, regardless of whether valid, the DS12C887 will perform this operation.
DS/RD: Data selection or read input pin. This pin has two working modes. When MOT is connected to VCC, the Motorola working mode is selected. In this working mode, DS is high in the last part of each bus cycle. flat, known as data strobe. In the read operation, the rising edge of DS causes the DS12C887 to send the internal data to the buses AD0~AD7 for external reading. In the write operation, the falling edge of DS will cause the data on the bus AD0~AD7 to be latched in the DS12C887; when MOT is connected to GND, the Intel operating mode is selected. In this mode, this pin is the read enable input pin, that is, Read Enable.
R/W: Read/write input terminal. This pin also has 2 working modes. When MOT is connected to VCC, R/W works in Motorola mode. At this time, the function of this pin is to distinguish whether a read operation or a write operation is performed. When R/W is high level, it is a read operation, and when R/W is low level, it is a write operation. When MOT is connected to GND, this pin Working in Intle mode, this is used as write enable input, that is, Write Enable.
CS: Chip select input, active low level.
IRQ: Interrupt request input, active at low level. When this pin is active, it has no effect on the clock, calendar and RAM contents in the DS12C887. It only affects the internal control register. In typical applications, RESET can be directly connected to VCC. , this can ensure that the internal control registers of DS12C887 are not affected when the power is turned off.
There are 11 bytes of RAM in the DS12C887 for storing time information and 4 bytes for storing control information. The specific addresses and values are listed in Table 1.
As can be seen from Table 1: DS12C887 has four control registers including AB of the control register, and users can access them at any time to control the DS12C887.
Table 1 Storage functions of DS12C887
address | Function | Value range decimal number | Ranges | |
binary | BCD code | |||
0 | Second | 0~59 | 00~3B | 00~59 |
1 | second alarm | 0~59 | 00~3B | 00~59 |
2 | point | 059 | 00~3B | 00~59 |
3 | Alarm clock | 0~59 | 00~3B | 00~59 |
4 | 12 hour mode | 0~12 | 01~0C AM, 81~8C PM |
01~12AM, 81~92PM |
24 hours mode | 0~23 | 00~17 | 00~23 | |
5 | Hour alarm, 12-hour clock | 1~12 | 01~0C AM, 81~8C PM |
01~12AM, 81~92PM |
Alarm clock, 24-hour clock | 0~23 | 00~17 | 00~23 | |
6 | Day of the week (Sunday=1) | 1~7 | 01~07 | 01~07 |
7 | day | 1~31 | 01~1F | 01~31 |
8 | moon | 1~12 | 01~0C | 01~12 |
9 | Year | 0~99 | 00~63 | 00~99 |
10 | Control register A | |||
11 | Control register B | |||
12 | Control register C | |||
13 | Control register D | |||
50 | century | 0~99 | NA | 19,20 |
3 applications
In various equipment, home appliances, instruments, and industrial control systems, DS12C887 can be easily used to form a time acquisition unit to achieve various time acquisitions. Figure 2 is a time acquisition circuit diagram composed of 8031 microcontroller and DS12C887. The base address of DS12C887 is 7F00H, and the corresponding program is written in C51 language (taking Intel working mode as an example).
The initialization procedure of the time acquisition circuit composed of 8031 microcontroller and DS12C887 is as follows:
XBYTE[0x7F00+0x0B]=0x82;
XBYTE[0x7F00+0x0A]=0xA0;
XBYTE[0x7F00+0x0A]=0x20;
XBYTE[0x7F00+0x0B]=0x02;
/*All interrupts are disabled, 24-hour clock, BCD code mode*/
The following are all time programs:
unsigned char data t-century;
unsigned char data t-year;
unsigned char data t-month;
unsigned char data t-date;
unsigned char data t-week;
unsigned char data t-hour;
unsigned char data t-minute;
unsigned char data t-second;
if((XBYTE[7F00+0x0A]&0x80)!=0){
t-century=XBYTE[0x7F00+0x32];/*Read century*/
t-year=XBYTE[Ox7F00+0x09];/*Read year*/
t-month=XBYTE[Ox7F00+0x08];/*Read month*/
t-date=XBYTE[Ox7F00+0x07];/*Read date*/
t-week=XBYTE[Ox7F00+0x06];/*Read the day of the week*/
t-hour=XBYTE[Ox7F00+0x04];/*Read hour*/
t-minute=XBYTE[DS12887+0x02];/*Read minute*/
t-second=XBYTE[Ox7F00+0x00];}/*Read seconds*/
4 Conclusion
Dallas company's clock and calendar chip DS12C887 is rich in functions, simple to use, and has high possibilities. It is a good choice for time generation circuits.
Previous article:A new type of clock and calendar chip DS12C887
Next article:A new type of clock and calendar chip DS12C887
Recommended ReadingLatest update time:2024-11-16 22:39
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Electronic hourglass based on physical model
- EEWORLD University Hall----Live Replay: Melexis High Reliability Programmable Hall Switch
- 2. Onboard RGB light control
- How to self-test the fault of resistor parallel circuit?
- Auxiliary trainer for plank and push-up exercises
- MSP430 sets the main clock source, main clock source and auxiliary clock source
- What are the transmission distances of Zigbee and Bluetooth respectively? Which one has unlimited distance transmission?
- Impedance Matching and the Smith Chart: The Basics
- ATH10 temperature and humidity measurement is inaccurate
- Happy Little New Year! How many days off do you have for the New Year?