Overall
design Design requirements
According to the design requirements, this system has the following main functions: (1) The buzzer can be used by 4 contestants or four teams at the same time; (2) The host can set the answering or answering time by himself; (3) It can display the countdown of the answering or answering time; (4) When someone breaks the rule, it can display the contestant number, flashing display and buzzer alarm; (5) When there are 5 seconds left in the answering time, the buzzer alarm prompts.
Working principle of the buzzer
The single-chip microcomputer is used to control each functional module to realize the buzzer function. The single-chip microcomputer collects the contestant's buzzer signal, uses the register to identify and record the first contestant number, transmits the information to the digital tube display, and the internal timer works to record the relevant time and generate a timeout signal. When the buzzer is successful and the countdown ends, there is a buzzer alarm reminder, thereby realizing the single-chip microcomputer buzzer function.
According to the design requirements and the working principle of the single-chip microcomputer, the workflow diagram of the buzzer is designed as shown in Figure 1.
Figure 1 Workflow diagram of the buzzer
Hardware design
In terms of hardware design, the single-chip microcomputer AT89C51 is used to control the buzzer module, display module, timing and adjustment module, buzzer prompt module and reset module, thereby realizing the single-chip microcomputer buzzer. The system hardware design schematic diagram is shown in Figure 2.
In Figure 2, U1 is the MCU AT89C51, K1~K4 are 4-way answer buttons, connected to P1.0 to P1.3 respectively; the start key and the end key are connected to the 10th and 11th pins of the MCU respectively. Since the 10th and 11th pins of the MCU have both the serial interface RXD and TXD functions and the IO port functions of P3.0 and P3.1, the buttons here use the IO port functions of the 10th and 11th pins of the MCU. The answer time adjustment button and the answer time adjustment button are connected to the 13th and 14th pins of the MCU respectively, and the "plus one" button and the "minus one" button are connected to the 15th and 16th pins of the MCU respectively. The 4-bit seven-segment digital tube segment selector is connected to the P0 port, the bit selector is connected to the lower 3 bits of the P2 port, and the buzzer output signal is connected to the P3.7 port. [page]
Figure 2 Hardware design schematic diagram
Display module
The display module uses the common 4-bit seven-segment common anode digital tube and uses its dynamic display method to achieve it. The 7 input terminals A~G of the digital tube are connected to P0.0~P0.6 of AT89C51 respectively, and the bit selection codes COM1, COM3, and COM4 are connected to P2.0, P2.1, and P2.2 of the single-chip microcomputer respectively. The single-chip microcomputer determines which bit should be displayed at present. Since the P0 port of the AT89C51 single-chip microcomputer does not have a built-in pull-up resistor, this system uses an external 10kΩ pull-up resistor (using A103 resistor) to ensure that the P0 port is in a high level state when there is no data output.
Key input module
The input signal of the buzzer is controlled by 11 keys, including 4 buzzer keys, 4 countdown adjustment keys, 1 start key, 1 end key, and 1 reset key. Each key has a signal line connected to the single-chip microcomputer circuit, and all keys have a common terminal. Each key is independent of each other and does not affect each other. When a key is pressed, the corresponding single-chip microcomputer pin responds and generates a valid input signal.
Buzzer prompt module
In this design, the 16th pin of AT89C51 is used to drive the buzzer to sound through the driver. The piezoelectric buzzer requires a driving current of about 10mA. The current amplification effect of the transistor can be used to drive the buzzer to achieve a sound prompt.
Reset module
The reset module consists of a reset button, a resistor R1, and an electrolytic capacitor C3. Since the microcontroller is reset at a high level, when the reset button is pressed, the 9-pin RESET pin of the microcontroller is at a high level. At this time, the microcontroller is in a reset state. After power-on, due to the slow charging of the capacitor, the voltage of the 9-pin of the microcontroller gradually changes from high to low. After a period of time, the 9-pin of the microcontroller is in a stable low-level state. At this time, the microcontroller is powered on and reset, and the system program starts to execute from 0000H.
Two functions, hardware reset and software reset, are used in this design. After the hardware reset, the values of each state, register, and memory are restored to the initial value. Adjusting the countdown time for answering and answering requires a memory function, so a soft reset is used. When the program is executed, the jump instruction jumps the program to the starting address of the program execution.
Software Design The
answering machine requires a timing memory function. After the time is set once, there is no need to re-set the time after reset. The contestants answer by pressing the keyboard keys, and then the single-chip microcomputer converts it into a font code that can be displayed on the seven-segment digital tube. After the answer is completed, the answering contestant number is displayed on the digital tube, indicating that the answer is successful and the countdown begins.
Figure 3 Software Design Flowchart
[page]
Based on this design idea, the system software design flow chart is shown in Figure 3. The system uses Keil software to write assembly language with reference to the software flow chart. Taking the display module as an example, the corresponding program segments are as follows:
DISPLAY:MOV DPTR,#DAT1; Look-up display program, P0.0~P0.6 segment selection, P2.0~P2.2 bit selection;
MOV A,R5
MOVC A,@A+DPTR
MOV P2,#01H
MOV P0,A
ACALL DELAY
MOV DPTR,#DAT2
MOV A,R4
MOVC A,@A+DPTR
MOV P2,#02H
MOV P0,A
ACALL DELAY
MOV A,R3
MOVC A,@A+DPTR
MOV P2,#04H
MOV P0,A
ACALL DELAY
RET
DAT1 B 00H, 06H,5bH,4fH,66H,6dH,7dH,07H,7fH,6fH,00H,71H;
DAT2 B 3fH, 06H, 5bH, 4fH, 66H, 6dH, 7dH, 07H, 7fH, 6fH, 00H, 71H 71H;
System simulation based on Proteus
Proteus software can not only simulate the working conditions of the microcontroller, but also the working conditions of the microcontroller peripheral circuits or other circuits without the participation of the microcontroller. After simulation, this design realizes the expected function of the buzzer. Module for
successful answering
Figure 4 shows that contestant No. 4 answered successfully, and there are 52 seconds left to answer the question. When the answering time is less than 5 seconds, there will be a buzzer alarm.
Figure 5 shows that contestant No. 1 illegally answered the question before the host pressed the start button. At this time, the digital tube kept flashing and accompanied by a buzzer alarm.
Time adjustment module
Figure 6 shows the time of adjusting the answer time and answer time by the "plus one" or "minus one" key. At this time, the time displayed on the digital tube is set to 58 seconds.
Reset module
Figure 7 shows that the initial state "FFF" is displayed on the digital tube at the beginning of work and after reset. This design uses hardware reset and software reset: when only the system default answer time and answer time are used, both resets can achieve the desired purpose; when the countdown time has been reset, the application software reset is required, which only jumps after executing the command and has no effect on the content of the general register in the chip. Hardware reset will initialize the state of the special register.
Hardware implementation
On the basis of achieving the predetermined goal through Proteus simulation, the single-chip microcomputer AT89C51, reset circuit, buzzer circuit, display circuit, key circuit and power supply circuit are welded, and the completed 4-way answerer is shown in Figure 8.
Figure 8 Picture of the real answering machine
Conclusion
This design uses the actual circuit as the final result, and realizes the expected functions such as answering, countdown, and alarm. It can be applied to general competition occasions and has certain practical value. In addition, this design has strong scalability, such as automatically controlling the scorer to score, and communicating with the PC through the serial port, using the PC to count the scores of the players, realizing intelligent, fair, and just answering, and reducing the influence of human factors. The answering button can also be realized by wireless devices, such as infrared, so that the answering players can answer from a distance, simplifying the line layout of the button module.
Previous article:Summary of MCS-51 MCU instruction fast memory method
Next article:Big Prawn talks about getting started with 51 single-chip microcomputer!
Recommended ReadingLatest update time:2024-11-16 20:37
- Popular Resources
- Popular amplifiers
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- Single-chip microcomputer C language programming and simulation
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
- Single chip microcomputer control technology (Li Shuping, Wang Yan, Zhu Yu, Zhang Xiaoyun)
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
- TMU Introduction and Usage
- Tracking 0 ~ ± 15V regulated power supply
- The reason why there is a big difference in efficiency between electromagnetic excitation motors and permanent magnet motors
- Do you also design a power supply for pulse loads in this way? If you have any questions, please come in~
- Talk about the MSP430 library about UART asynchronous serial port
- lvds(1440*540) pointer
- I would like to ask how you learn this tutorial on circuit design based on operational amplifiers and analog integrated circuits.
- Share the method of setting the serial port baud rate of MSP430
- [RISC-V MCU CH32V103 Review] - 3: USART - Why did all three serial port tools fail?
- Bluetooth Protocol Analysis_Basic Concepts