This is a project that the teacher asked me to do. Now it has been completed without any major problems.
1. Design requirements and scheme demonstration
1.1 Design requirements:
1.1.1 Basic requirements:
1. There are three types of traffic lights: red, yellow and green in both the east-west and north-south directions. The initial red light is 30 seconds, the yellow light flashes for 3 seconds, and the green light is 30 seconds. The east-west direction has a red light, the north-south direction has a green light, the north-south direction has a green light, and the east-west direction has a red light.
2. Button adjustment and control function. By pressing the button, you can control the green light in one direction to be on for a long time and the red light in another direction to be on for a long time. By pressing the button, you can control the length of the red light in a certain direction. For example, adjust the red light in the east-west direction to 40 seconds and the green light to 20 seconds. At the same time, the red light in the north-south direction is 20 seconds and the green light is 40 seconds.
3. Press the night mode button and the yellow light flashes in all directions
4. Real-time reminder of the remaining time of the light
1.1.2 Extension part:
Not yet expanded
1.2 System basic scheme selection and demonstration:
1.2.1 Selection and demonstration of single chip microcomputer:
8051 core produced by STC, CMOS technology;
1.2.2 Selection and demonstration of digital tube display module:
The digital tube selected is a common anode. The driving ability of the microcontroller is not very strong, so a common anode digital tube is selected;.
1.2.3 Selection and demonstration of LED lamps:
The current through an LED lamp is about 10ms.
1.3 Final circuit design solution
2.1 The table number is generated by timer T0
TH0=0xFC; TL0=0x67; Interrupt every 1ms and change the value of the marker of the entire project.
2.2 Omitted;
3.1 Circuit Design Block Diagram
3.2 System Hardware Description
The main hardware is the 89C51 chip for input and output control.
3.3 Design of main unit circuits
3.3.1 Design of MCU main control module
3.3.2 Design of digital tube module
3.3.3 Design of LED lamp module
3.3.4 Power supply voltage regulator module
4.1 Program flow chart
4.2 Digital tube module flow chart
4.3 Key adjustment module design block diagram
5.1 Test Equipment
The multimeter can be used to detect whether there is continuity or short circuit.
5.2 Software Testing Platform Keil C51
5.3 Hardware Testing
5.3.1 Display module test
5.4 Test results analysis and conclusion
5.4.1 Test results analysis
The above functions can already be realized.
5.4.2 Test Conclusion
The testing has been completed and the required functionality has been achieved.
Works Summary
During the production process of this work, I became more comfortable and proficient in the use of multimeter, C language, and Proteus.
Appendix 1: System Circuit Diagram
Appendix 2: System C Program
#include #define uint unsigned int; #define uchar unsigned char; void DigitalTube(); //Digital tube display function void InterruptT0(); //Internal interrupt 0 sbit P10 = P1^0; // Initialization of traffic light pins sbit P11 = P1^1; sbit P12 = P1^2; sbit P13 = P1^3; sbit P14 = P1^4; sbit P15 = P1^5; sbit P16 = P1^6; // Digital tube enable control sbit P17 = P1^7; sbit P20 = P2^0; sbit P21 = P2^1; sbit K22 = P2^2; //key 22 sbit K23 = P2^3; sbit K24 = P2^4; sbit dula = P2^5; uint LedBuf[10] = { 0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8, 0x80,0x90 }; //0~9 digital display common anode uint Kflag = 1; //Flag of key 24 uint LedNumNS = 27; //digital display of north and south uint LedNumEW = 30; //Digital display of things uint i = 0; uint j = 0; uint j1 = 0; uint k = 0; uint g = 0; uint z = 0; //Count and status variables uint LedTime1 = 30; uint LedTime2 = 27; uint LedTime3 = 30; uint LedTime4 = 27; uint Kf22 = 1; //The value of the previous state of the key uint Kf23 = 1; uint Kf24 = 1; uint KSta24 = 1; //Current value of the button uint KSta23 = 1; uint KSta22 = 1; uchar Kflag22 = 0; //switch function parameter for key 22 void main() { EA = 1; // Enable general interrupt ET0 = 1; //Open internal interrupt 0 TR0 = 1; TMOD = 0x01; // Mode 1 TH0 = 0xFC; TL0= 0x67; //1ms interrupt P1 = 0xEE; // while(1) { DigitalTube(); //Digital tube display } } void InterruptT0() interrupt 1 { TH0 = 0xFC; TL0 = 0x67; //1ms interrupt i++; k++; KSta24 = K24; //Key K24 Night Mode if(Kf24 != KSta24) //The key is activated { if(Kf24 == 1) //button pressed { Kflag = !Kflag; } Kf24 = KSta24; } KSta23 = K23; // Press K23 to increase or decrease the duration if(Kf23 != KSta23) //The key is activated { if(Kf23 == 1) //button pressed { // LedTime = LedTime +2; LedTime1 = LedTime1 +5; //32 34 36 38 30 LedTime2 = LedTime2 +5; //25 23 21 19 17 LedTime3 = LedTime3 +5; LedTime4 = LedTime4 +5; if(LedTime1 >=60) { LedTime1 = 10; LedTime2 = 7; LedTime3 = 10; LedTime4 = 7; } LedNumEW = LedTime1; LedNumNS = LedTime2; } Kf23=KSta23; } KSta22 = K22; // Press K22 to turn on the red light in a certain direction for a long time if(Kf22 != KSta22) //The key is activated { if(Kf22 == 1) //button pressed { Kflag22 ++; if(Kflag22>= 3) { Kflag22 = 0; } switch(Kflag22) { case 1: LedTime1 = 50; LedTime2 = 47; //case2 LedTime3 = 20; LedTime4 = 17; //case1 LedNumEW = LedTime1; LedNumNS = LedTime2; break; case 2: LedTime1 = 20; LedTime2 = 17; //case2 LedTime3 = 50;
Previous article:Design of natural gas leak alarm system based on single chip microcomputer
Next article:STC89C52RC MCU + Serial Port + Infrared Control 16-channel Servo Program
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- What is the purpose of the PG pin?
- [Mil MYD-YA15XC-T Review] + epoll serial communication
- TI 2018 Annual Educators Conference, friends in Wuhan, let’s get started!
- DC-DC
- Will the power supply problem not allow 32 this year?
- Practical information is here|【TI Embedded Seminar Highlights】The site has added a lot of new content
- When a computer starts the operating system, it loads the system on the disk into the memory and runs it. Does the microcontroller have a similar operating mode?
- Low-pass filter, high-pass filter, integral circuit, differential circuit
- TI C6000 Hardware Architecture Optimization Strategy
- Full of useful information! How to choose a rectifier bridge?