黄土马家

89C52 programming cool heart-shaped running water lamp

 
Overview

I applied for a job as a lecturer on the Lichuang EDA campus and planned to offer a training course on PCB design. The teaching software used was the domestic Lichuang EDA. The content of the course was from beginners to making some real projects. After all, Jilichuang’s free shipping is 0 yuan. PCB proofing is still very delicious.

The first project should not be too difficult, and it should be interesting enough to stimulate students' interest in learning. So I chose to use a 51 microcontroller to make a heart-shaped running water lamp.

The main control chip uses STC89C52RC401, the LEDs use 2.5MM plug-in light-emitting diodes, and the microcontroller pins are driven at a high level.

Professional presentation:

STC89C52RC:
STC89C52RC is a low-power, high-performance CMOS 8-bit microcontroller produced by STC Company with 8K bytes of system programmable Flash memory. STC89C52 uses the classic MCS-51 core, but has made many improvements to make the chip have functions that traditional 51 microcontrollers do not have. On a single chip, it has a smart 8-bit CPU and in-system programmable Flash, making the STC89C52 a highly flexible and ultra-effective solution for many embedded control application systems. Has the following standard functions: 8k bytes Flash, 512 bytes RAM, 32-bit I/O port line, watchdog timer, built-in 4KB EEPROM, MAX810 reset circuit, 3 16-bit timers/counters, 4 external interrupts , a 7-vector 4-level interrupt structure (compatible with the traditional 51-vector 2-level interrupt structure), full-duplex serial port. In addition, STC89C52 can reduce to 0Hz static logic operation and supports 2 software-selectable power-saving modes. In idle mode, the CPU stops working, allowing RAM, timers/counters, serial ports, and interrupts to continue working. In the power-down protection mode, the RAM contents are saved, the oscillator is frozen, and all work of the microcontroller stops until the next interrupt or hardware reset. The maximum operating frequency is 35MHz, 6T/12T optional.

Crystal oscillator circuit:
There is a crystal oscillator in every single-chip computer system. The full name is crystal oscillator. The crystal oscillator plays a very important role in the single-chip computer system. It combines with the internal circuit of the single-chip computer to generate the necessary clock frequency for the single-chip computer and executes all instructions of the single-chip computer. It's all based on this. The higher the clock frequency provided by the crystal oscillator, the faster the microcontroller will run.

The crystal oscillator uses a crystal that can convert electrical energy and mechanical energy into each other to work in a resonance state to provide stable and accurate single-frequency oscillation. Under normal working conditions, the absolute accuracy of the ordinary crystal oscillator frequency can reach 50 parts per million. Advanced accuracy is higher. Some crystal oscillators can also adjust the frequency within a certain range by an external voltage, called a voltage-controlled oscillator (VCO).

The role of the crystal oscillator is to provide the basic clock signal for the system. Usually a system shares a crystal oscillator to facilitate the synchronization of various parts. Some communication systems use different crystal oscillators for the base frequency and radio frequency, and maintain synchronization by electronically adjusting the frequency.

LED light:
LED (Light Emitting Diode), light-emitting diode, is a solid-state semiconductor device that can convert electrical energy into visible light. It can directly convert electricity into light. The heart of the LED is a semiconductor chip. One end of the chip is attached to a bracket, one end is the negative electrode, and the other end is connected to the positive electrode of the power supply, so that the entire chip is encapsulated in epoxy resin.

The semiconductor wafer is composed of two parts. One part is a P-type semiconductor, in which holes dominate, and the other end is an N-type semiconductor, where electrons are mainly present. But when these two semiconductors are connected, a PN junction is formed between them. When current acts on the wafer through the wire, the electrons will be pushed to the P region, where the electrons will recombine with holes, and then energy will be emitted in the form of photons. This is the principle of LED light emitting. The wavelength of light, also known as the color of light, is determined by the material forming the PN junction.

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2024-11-22 12:49:00

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号