太白金星

STC89C51 clock

 
Overview

lct.png As shown in Figure 2-1, this system uses STC89C51RC microcontroller as the core. The clock chip provides time and date information. The temperature and humidity detection module collects temperature and humidity information. The function key input cooperates with the main control chip to realize various functions. LCD1602 is used as the display. Information and human-computer interaction interface are provided, and the buzzer can realize various prompt sounds.

#

  • 1 Hardware design

1.1 Display module

LCD1602 interface circuit.png

The display module uses LCD1602 liquid crystal screen. LCD1602 liquid crystal display is a widely used character-type liquid crystal display module. It consists of a character-type liquid crystal display (LCD), main control and drive circuit HD44780 and its extended drive circuit HD44100, as well as a small number of resistors, capacitors and structural parts assembled on a PCB board. The circuit uses pin headers to connect the LCD1602 display module to the circuit. The circuit diagram is shown in Figure 3-1.

Table 3-1 shows the pin function diagram of LCD1602. Its number corresponds to the number of the female header U3 port. Port 3 is used to adjust the contrast of the liquid crystal. The contrast is the weakest when connected to the positive power supply, and the contrast is the highest when connected to the ground. If it is too high, a "ghosting" phenomenon will occur, so a 10K variable resistor is added to adjust the contrast to make the LCD character display clearer. Port No. 5 corresponds to the R/W pin. According to the actual system function requirements, this port is directly grounded to save the microcontroller port.

Table 3‑1 LCD1602 pin function table

serial number symbol Pin description label symbol Pin description

1

VSS
power ground
9

D2|
data

2

VDD
Positive pole of power supply
10

D3
data

3

VL
LCD bias
11

D4
data

4

RS
Data/command selection
12

D5
data

5

R/W
read/write selection
13

D6
data

6

E
enable signal
14

D7
data

7

D0
data
15

BLA
Backlight positive electrode

8

D1
data
16

BLK
Backlight negative electrode

1.2       Temperature and humidity sensor

Temperature and humidity detection circuit.png

The temperature and humidity sensor uses the DHT11 sensor. The DHT11 digital temperature and humidity sensor is a temperature and humidity composite sensor with calibrated digital signal output. It applies dedicated digital module acquisition technology and temperature and humidity sensing technology to ensure that the product has extremely high reliability. and excellent long-term stability. The single-wire serial interface makes system integration easy and fast. The ultra-small size and extremely low power consumption make it the best choice for this type of application in harsh applications.

Table 3-2 shows the pins and functions of the DHT11 temperature and humidity sensor. Its pins correspond to the U1 pin numbers in Figure 3-2. A 4.7K resistor is pulled up on the DATA serial data bus to improve communication stability and accuracy. .



Table 3‑2 DHT11 pin function diagram

serial number name Functional comments

1

VDD
Power supply 3-
5.5VDC

2

DATA
Serial data, single bus

3

NC
Free feet, please hang them in the air

4

GND
Ground, negative pole of power supply

Figure 3‑2 DHT11 module circuit

1.3 DS12C887 module

The clock chip uses the DS12C887 clock chip. The DS12C887 clock calendar chip adopts a 24-pin dual-in-line package. It integrates a crystal oscillator, an oscillation circuit, a charging circuit and a rechargeable lithium battery to form a thickened integrated circuit module. When there is no external power supply can work for 10 years. It has the advantages of good microcomputer interface, high precision, simple peripheral interface, stable and reliable operation, etc., and can be widely used in various real-time situations that require higher precision.

The DS12C887 clock chip module circuit is shown in Figure 3-3, and the clock chip pins and functions are shown in Table 3-3. The MOT pin is grounded and the working mode is selected as Motorola mode, using the Motorola communication protocol. When no interrupt condition exists on the IRQ# pin, the IRQ level is in a high impedance state, so the 4.7K resistor is pulled up, and the RESET# pin is directly connected to VCC. This ensures that the internal control registers of the DS12C887 are not affected when the power is turned off.

Table 3‑3 DS12C887 pin function table[2]


serial number name Pin description

1

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.
twenty
three

NC
Empty feet

4~11

AD0~AD7
Multiplexed address data bus, which uses time division multiplexing technology. In the first half of the bus cycle, address information appears on AD0~AD7, which can be used to strobe the RAM in the DS12C887. In the second half of the bus cycle, it appears on AD0 ~Data information on AD7.

12

GND
power ground

13

CS#
Chip select input, active low level.

14

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 it is valid or not. The DS12C887 will do this.

15

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 a write-enabled input.

16

NC
Empty feet

17

DS
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 in the last part of each bus cycle is high level, which is called Gating the data. 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. During a write operation, the falling edge of DS will cause the data on the buses AD0~AD7 to be latched in the DS12C887.

18

RESET#
Clock reset input

19

IRQ#
Interrupt request input, active at low level. When this pin is active, it has no effect on the clock, calendar and contents of RAM in the DS12C887. It only affects the internal control register. In typical applications, RESET can be directly connected to VCC. This ensures that the internal control registers of the DS12C887 are not affected when the power is turned off.
20, 21,
22

NC
Empty feet

twenty three

SQW
Square wave output pin. When the 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 square wave signals by programming the control register .

twenty four

VCC
Power supply positive
+5V

DS12C887 module circuit.png

Figure 3‑3 DS12C887 module circuit

1.4 Buzzer sound circuit


The buzzer sound circuit is shown in Figure 3-4. The buzzer uses a passive buzzer and uses a triode to drive the buzzer. When P15 outputs a low level, the triode is turned on, and P15 outputs pulse signals of different frequencies through the microcontroller. To drive the passive buzzer to sound different frequencies. Resistors R3 and R8 are used to limit the path current and prevent excessive current from damaging the circuit. Figure 3‑4 Buzzer drive circuit Buzzer drive circuit.png

1.5 Button input circuit

Button circuit.png

The system has four function buttons and one reset button. The circuit diagram is shown in Figure 3-5. The setting button, temperature and humidity display button, value setting button, and confirmation button are respectively connected to the IO port of a microcontroller. When the button is pressed, the circuit is turned on, and the level of the IO port connected to the button is pulled low. The microcontroller detects this low power. The flat signal determines whether the corresponding button is pressed. Among them, SW3 (temperature and humidity display button) is connected to P3.3 (INT1) of the microcontroller and uses interrupts to realize the temperature and humidity display function.




参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-07-08 20:10:21
  • [Photo] The vacuum cleaner exchanged for E coins has arrived
  • PICO online graphical programming website
  • 430 Information
  • Preheating for Double 11, Infineon flagship store’s hot-selling list leaked!
  • Robotics Lecture 5
  • 大俠們幫幫忙啊

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

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号