introduction
The principle of single-chip microcomputer is widely used. According to the requirements of the single-chip microcomputer principle and application course, two aspects of design are mainly carried out, namely the single-chip microcomputer minimum system and memory expansion design, and interface technology application design. Among them, the single-chip microcomputer minimum system mainly requires students to be familiar with the internal structure and pin function of the single-chip microcomputer, the use of pins, reset circuit, clock circuit, 4 parallel interfaces and the practical application of a serial interface, so as to form a minimum application system and program it for simple use. The electric fan simulation control system has the advantages of simple circuit, low cost, convenient operation, sensitivity and reliability, etc. It has good results after use, has high promotion value, and has a wide range of applications in many fields.
This paper designs an electric fan simulation control system with STC89S52 single-chip microcomputer as the core, and adopts the design idea of LCD1206 direct indication, display status, and automatic reset. It can generate different output signals corresponding to the input signals according to the signals input by the keys, and finally display the corresponding status through LCD1206, which respectively displays the current real-time temperature of the motor and the current wind speed, making full use of the characteristics of the single-chip microcomputer system with simple structure, powerful functions, good reliability and strong practicality.
1. Solution Design
1.1 Introduction
I first designed the hardware circuit, which fully embodies the idea of modularization and is mainly composed of the following modules:
STC89C52 single-chip microcomputer minimum system;
Button module: There are six buttons in total, three of which control the wind speed, and two control the motor's shaking and sleep timer functions;
LED indicator module: There are four green LED indicators, indicating the fan motor operating status, natural wild, ordinary wind, sleep wind, no wind
Motor temperature real-time measurement module: This system uses DS18B20 to measure the real-time temperature of the motor
Motor drive module: This system uses LM298N integrated driver chip to drive the motor to rotate
LCD display module: This system uses LCD1206 module to display the real-time status of the electric fan
1.2 Course Design Purpose
(1) Complete this course design based on the theoretical knowledge learned from courses such as microcontroller principles and interface technology;
(2) Learn and master basic circuit design and usage methods, and microcontroller programming and application methods;
(3) Improve the ability to conduct comprehensive analysis and solve practical problems.
1.3 Tasks and requirements
This design uses the STC89C52 processor as the core, and the single-chip microcomputer as the peripheral detection and control circuit design to realize the smart home system. The single-chip microcomputer system detects relevant information through sensors and sends corresponding information to the embedded platform. The embedded platform makes corresponding judgments and processing, and at the same time informs the owner and property management personnel through the network to make corresponding processing to ensure the property and personal safety of the owner.
The main design indicators of this design are:
Key input module, 4 keys to adjust "sleep wind", "natural wind", "normal wind" and "no wind" respectively
2 buttons control "shaking head" and "timing" respectively;
DC motor speed control, driven by LM298N chip;
(3) The current speed and motor temperature are displayed, and the status is displayed on the LCD.
2. Hardware circuit
2.1 Circuit system block diagram
2.2 STC89C52RC minimum system
2.3 Button Module
TIME BUTTON: Time button
SHAKE BUTTON: Shake button
NATURAL WIND Natural wind button
ORDINARY WIND Ordinary wind button
SLEEP WIND sleep wind button
2.4 LED indicator module
NATURAL WIND Natural wind indicator
ORDINARY WIND Ordinary wind indicator light
SLEEP WIND Sleep wind indicator light
NO WIND No wind indicator
2.5 Motor temperature real-time measurement module
Using DS18B20 to measure the real-time temperature of the motor
2.6 Motor drive module
Use LM298N driver chip to drive two DC motors
2.7 LCD Display Module
Use LCD1206 output to display the current status
2.8 Buzzer alarm module
3. Software Program 3.1 Main Function Program Flowchart
3.2 Keyboard Module Driver
#include "head_file.h"
sbit Natural_wind_button =P2^0;
sbit Ordinary_wind_button =P2^1;
sbit Sleep_wind_button =P2^2;
sbit Time_button =P3^6;
sbit Shake_button =P3^7;
void BUTTON_Config()
{
Natural_wind_button = 1;
Ordinary_wind_button = 1;
Sleep_wind_button =1;
Time_button = 1;
Shake_button = 1;
}
3.3 LED indicator driver
#include "head_file.h"
sbit Natural_wind_LED =P2^3;
sbit Ordinary_wind_LED =P2^4;
sbit Sleep_wind_LED =P2^5;
sbit NO_Wind_LED =P2^6;
sbit Buzzer =P0^3;
void GUIDE_Led_Config()
{
Natural_wind_LED = 1;
Ordinary_wind_LED = 1;
Sleep_wind_LED = 1;
NO_Wind_LED = 0;
Buzzer = 0;
}
4. Debugging results
summary
After nearly a week of single-chip microcomputer course design, I finally completed the design of the electric fan simulation control system. Although it did not fully meet the design requirements, I still gained a lot. Through this course design, I became more familiar with the working principle of single-chip microcomputer chips and their specific usage methods. The focus of single-chip microcomputer course design is on the design of software algorithms, which requires very clever program algorithms. This has trained my ability to think independently and the habit of solving problems by looking up relevant materials. I also learned about the general steps of course design and the issues that should be paid attention to in the design.
Course design requires each of us to do it attentively, seize the opportunity to learn, and combine theory with practice by consulting more information. When doing simulation, using what you have learned in your daily life and the guidance of teachers to students, you can experience the pleasure of seeking knowledge in unlimited exploration. When you make a work or a simulation experiment is successful, you can always feel that the fruits of labor are hard-won. While designing the course, I not only exercised my hands-on and brain-power abilities, but also broadened my knowledge. I am grateful to myself and the hard-working teachers.
I would like to thank the teacher for giving me such an opportunity to exercise. During the whole design process, I learned a lot of things, and also cultivated my ability to study and work independently. I established a good learning attitude and humbly asked for advice. I believe it will have a very important impact on my future study, work and life. It also greatly improved my hands-on ability, allowing me to fully experience the difficulties of exploration and the joy of success in the creative process. Although this project still has some shortcomings, what I learned during the design process is the biggest gain and wealth of this design, and I really benefited a lot.
Appendix 1: Overall Circuit Simulation
Appendix 2: Program List
Main.c //Main function
Button.c //Button driver program
ds18B20.c //ds18b20 driver program
guide_led.c //LED indicator initialization program
L298n.c //l298n driver program
Lcd1206.c //lcd1206 driver program
head_file.h //All header file declarations
Appendix 3: Component List
STC89C52RC microcontroller
1
touch switch
6
green LED lamp beads
4
12v DC motors
2
LM298N chips
1
DS18B20 sensor
1
LCD1206
1
1K chip resistor
4
4.7K chip resistors
1
100R resistor
2
motor driver programs
#include "head_file.h"
uchar t0, add0;
uchar t1,add1;
sbit EN0=P3^4;
sbit EN1=P3^5;
sbit IN0=P3^0;
sbit IN1=P3^1;
sbit IN2=P3^2;
sbit IN3=P3^3;
void L298_Config()
{
t0=50;
t1=50;
IN0=0;
IN1=1;
IN2=0;
IN3=1;
}
void TIM_Config()
{
TMOD = 0x11;
TH0 = (65536-50000)/256;;
TL0 = (65536-50000)%256;;
ET0 = 1;
TR0 = 1;
TH1 = (65536-50000)/256;;
TL1 = (65536-50000)%256;;
ET1 = 1;
TR1 = 1;
EA = 1;
}
void TIM0() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
if(add0==100)
{
add0=0;
EN0=1;
}
if(add0==t0)
{
EN0=0;
}
add0++;
}
void TIM1() interrupt 3
{
TH1=(65536-50000)/256;
TL1=(65536-50000)%256;
if(add1==100)
{
add1=0;
EN1=1;
}
if(add1==t1)
{
EN1=0;
}
add1++;
Previous article:Example of sending characters via 51 MCU serial port
Next article:Simple STC15F104E MCU Timing Alarm Production
- Popular Resources
- Popular amplifiers
- Typical Circuit Design and Application of New Switching Power Supply (2nd Edition)
- PFC GR8762KG+PWM GR8875N/R 120W-180W---24V/5A/6A/7.5A solution (GR8762 PIN TO PIN L6562 FAN7527B), maximum 300w
- Selected Design Calculations for Switching Power Supplies and LED Lighting
- Internet of Things (IoT) Basics: Network Technology + Protocols + Use Cases
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
- [Xingkong board Python programming learning main control board] Expansion board test and WS2812 driver
- The SSD cannot be formatted, not even in PE
- 【Arduino】168 Sensor and Actuator Module Series Experiments (221) --- 360° LiDAR Module
- [RTT & Renesas ultra-low power MCU RA2L1 development board] Evaluation of PWM module introduction and test, breathing light implementation
- [Sipeed GW2A FPGA development board] Development environment experience: the first program of lighting
- An interesting circuit
- Where are charge pumps generally used?
- Deep learning framework PyTorch: Getting started and practice
- Prize-winning quiz: Audio signal solution based on A2B
- Are the sampling frequency and sampling rate of the microcontroller ADC the same concept? The sampling frequency and rate must be much greater than the sampled...