introduction
This design uses the single-chip microcomputer AT89C51 to complete the timing function. It introduces the design process of the system hardware and software in detail, and designs a basketball timing system that uses AT89C51 programming to control the LED seven-segment digital tube for display. The system has functions such as schedule time setting, timing start, pause, alarm, 24 s and reset.
1 System Principle
The accuracy and precision of timing in basketball games are very high, and the single-chip microcomputer has an excellent performance in this regard. The system uses a chip with a frequency of 12 MHz. The entire system consists of buttons, timing display, alarm, arrow direction and other parts. The block diagram of the system is shown in Figure 1.
The single-chip microcomputer is the core component of the system circuit. All functions of the system are realized by programming in the single-chip microcomputer. The single-chip microcomputer uses AT89C51. Its X1 (19-pin) and X2 (18-pin) are connected to an external 12MHz crystal oscillator to provide a clock signal for the single-chip microcomputer. A ceramic capacitor with a capacitance value of 20 to 50 pF is connected to each of the two pins of the crystal oscillator to improve the stability of the crystal oscillator frequency. A total of 6 4-inch 7-segment common anode digital tube displays are connected to display the race time and record 24 s violation timing.
2 System Hardware Design
2.1 Timing control component design
The timing control component sends all the internal and external control signals required for various operations at the specified time, so that the various functional components work in coordination and complete the functions specified by the instructions. Its main task is to generate a working sequence, and its work requires the clock circuit to provide an operating frequency.
MCS-51 has a high-gain reverse amplifier inside to form an oscillator. The input and output of the amplifier are XTAL1 and XTAL2 respectively. An external clock source can be connected to XTAL1 and XTAL2 to form a clock circuit. A crystal or ceramic resonator is connected across XTAL1 and XTAL2 to form a stable self-excited oscillator with the internal inverter. The pulses it sends are directly sent to the timing control components inside the chip.
2.2 System reset circuit design
The design uses power-on plus button level reset, which is a combination of power-on automatic reset and button level reset. Power-on reset is achieved by charging the capacitor, that is, the potential of the RST/Vpd terminal is the same as Vcc at the moment of power-on. As the charging current decreases, the potential of RST/Vpd decreases and is finally reset to 0 V. When the button is pressed, the power supply Vcc is applied to the reset terminal RST/Vpd of the microcontroller through the resistor to reset the microcontroller.
2.3 Alarm
The design uses a 12 V electromagnetic iron diaphragm buzzer as an alarm. When the microcontroller sends a high level delay for a period of time, the signal is amplified by the transistor and drives the intermediate relay, which then drives the 12 V electromagnetic iron diaphragm buzzer, causing the electromagnetic coil to generate a magnetic field. The vibrating diaphragm vibrates and sounds under the interaction of the electromagnetic coil and the magnet.
2.4 Decoding and driving circuits
The decoding and driving part consists of two chips, 74LS248 and ULN2804A, with an input voltage of 12 V. The input end of 74LS248 is connected to the I/O port of the microcontroller, and the output end of ULN2404A is connected to the segment selection end of the digital tube.
3 Basketball timer software design
Before the game, turn on the power, the system automatically resets, and the time is set by toggling the "Set Time" button up and down. This design has set two time periods, 12 minutes and 10 minutes. Press the start button, and the timing circuit common anode digital tube timing part of the timer panel will display "12-00" or "10:00"; the 24 s timer will display "24". When the game starts, press the "Run" button, and the timer timing part and the 24 s part will start running at the same time.
During the game, you can use the ball possession button to control the direction of the arrow to show the team with the ball possession. If the team in possession of the ball does not violate the rules within 24 seconds, just press the "24 s reset" button. When a 24 s violation occurs, the buzzer will sound an alarm for 2 seconds.
When the quarter reaches the last 10 minutes, the timer sends a signal to the buzzer, and the buzzer alarms for 1 second. At this time, the timing display panel of the timer changes from "00-10" to "10-00". When the 24-second display panel changes to millisecond timing, it enters the 1/10-second countdown.
When the game is over, the buzzer alarm prompts for 4 seconds, the timing part of the timer panel displays "00-00", and the 24-second display displays "00". At this time, the game is over. The flow chart is shown in Figure 2.
[page]
4 System Debugging
4.1 Software Debugging
Use Keil μVision 3 for simulation debugging, run the program according to the design requirements, debug time, running steps, etc., and finally debug to the parameters required by the design.
(1) After the program is written, check the code line by line carefully. Check the code for errors, create your own code checklist, and check the places where errors are often made. Check whether the code complies with the programming specifications.
(2) Perform simulation tests on each subroutine. The simulation test method is to test the program with the program, compile a code to call the subroutine, establish the entry conditions of the subroutine to be tested, and then see whether it outputs the expected results.
(3) If the code has been modified, check the code again.
4.2 Hardware Debugging
Draw the circuit schematic in Proteus Professional 7.1 SP2 microcontroller simulation and circuit board design software. After building the basic circuit, set the parameters according to the design requirements. Then import the written program into the simulation hardware circuit and run it to observe whether the simulation phenomenon is consistent with the design requirements.
The main thing that needs to be debugged is the input voltage of the circuit. The current in the circuit is calculated to set the specific allowable current passing through each component, that is, Imax. When debugging the voltage-stabilized power supply, the parameters of the transformer, that is, the maximum current and power that can be provided, must be selected according to the calculation results. The size of the capacitor parameters should be reasonably selected to ensure the voltage regulation coefficient of the voltage-stabilized circuit. There is a certain gap between the effect obtained by simulation and the actual object produced, because there is electrical loss in the actual circuit, so these aspects must be considered when bridging the hardware circuit.
5. Notes
(1) Carefully check the correctness of the circuit according to the hardware circuit schematic and assembly drawing, and check whether the components are installed correctly. It is important to pay attention to whether the chip and switch tube model, the polarity of the amplifier and switch tube, the withstand voltage and polarity of the capacitor, and the resistance and power of the resistor are consistent with the design drawings. Focus on checking whether there is a short circuit between the system buses or between the bus and other signal lines.
(2) Check whether the soldering points are firm, especially carefully check for leaky soldering and wrong soldering; for adjacent soldering points that are very close to each other, pay attention to check for metal burrs and short circuits, and use a multimeter to measure if necessary. The debugging process may sometimes need to be repeated many times. In addition, when burning the program, it is important to note that the AT89 series microcontrollers have chip encryption by default.
(3) During the production process, the impact of current, voltage, and magnetic field on the microcontroller must be considered, and protective measures must be taken. An external protection circuit can be connected to eliminate the impact of inrush current, spike current, etc. on the operation of the microcontroller.
6 Conclusion
The timer has the advantages of simple time setting, complete functions, small size, easy to carry, etc. It can be widely used in schools, basketball clubs, gymnasiums or small groups as a timer for the schedule.
Previous article:Reliability Improvement Scheme for Single Chip Microcomputer System and Power-off Protection Circuit
Next article:Design of a Simple Digital Oscilloscope Based on AT89S52 Single Chip Microcomputer
Recommended ReadingLatest update time:2024-11-16 23:39
- Popular Resources
- Popular amplifiers
- 西门子S7-12001500 PLC SCL语言编程从入门到精通 (北岛李工)
- Siemens Motion Control Technology and Engineering Applications (Tongxue, edited by Wu Xiaojun)
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
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
- Let me express my feelings and talk about phone calls and scammers
- Some knowledge points about low-frequency amplifiers
- MC33063A boost circuit, burning IC and electrolytic capacitor? With pictures, help!
- Could anyone help me see what is wrong with my amplifier circuit?
- Can supercapacitors accelerate cars?
- There are two questions about the frequency division circuit, as shown in the figure
- C51 demonstration program of nrf905 with number hopping, frequency hopping and address hopping
- MicroPython Hands-on (24) - Expanding the Control Panel with the Control Panel
- [Flower carving hands-on] Interesting and fun music visualization series of small projects (14) --- water cup and bottle lamp
- Does TMS320C6748 support TFTP instance in stareware?