A new type of clock and calendar chip DS12C887

Publisher:小九分析仪Latest update time:2006-09-06 Source: 国外电子元器件Keywords:register  read  bus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Keywords:register  read  bus Reference address:A new type of clock and calendar chip DS12C887

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

Shift register and loop structure
I like C language very much, and it is also the language I use most in my actual work. The programming thinking of C is very different from that of LABVIEW. If you completely follow the thinking of C to program LABVIEW, you will often get half the result with twice the effort. However, there are many similar situation
[Test Measurement]
Shift register and loop structure
Application of GE Fanuc PLC in Ship Cargo Control System
1. System Overview The CARGOPRO system is mainly composed of four relatively independent subsystems, including: liquid level telemetry system, valve remote control system, independent high-level and high-high-level alarm system and large tank flooding alarm system. It can monitor and alarm the cargo control
[Industrial Control]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号