This design uses the single-chip microcomputer AT89C51 to complete the timing function. The design process of the system hardware and software is introduced in detail. The design uses the AT89C51 programming to control the LED seven-segment digital tube for display. The system has the functions of 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 excellent performance in this regard. The system uses a chip with a frequency of 12 MHz. The whole 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. The two pins of the crystal oscillator are connected in series with a ceramic capacitor with a capacitance value of 20-50 pF 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 time of the race and record the 24-second violation timing.
2 System Hardware Design
2.1 Timing Control Component Design
The timing control component sends all internal and external control signals required for various operations at the specified time, so that each functional component works in coordination and completes the functions specified by the instruction. The main task is to generate a working sequence, and its operation requires a clock circuit to provide a working frequency.
MCS-51 has a high-gain reverse amplifier for forming an oscillator. The input and output ends of the amplifier are XTAL1 and XTAL2 respectively. An external clock source on XTAL1 and XTAL2 can 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 pulse it sends is directly sent to the timing control component in the chip.
2.2 System reset circuit design
The design adopts 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. The button level is reset. When the button is pressed, the power supply Vcc is applied to the reset terminal RST/Vpd of the microcontroller through a 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, and then the intermediate relay drives the 12 V electromagnetic iron diaphragm buzzer, so that the electromagnetic coil generates a magnetic field. The vibrating diaphragm vibrates and makes sound under the interaction of the electromagnetic coil and the magnet.
2.4 Decoding and driving circuit 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
First, before the game, turn on the power and the system automatically resets. First, set the time. Set the game time by toggling the "set time" button up and down. This design has set two times for 12 minutes and 10 minutes. Press the start button, and the timing circuit of the timer panel will display "12-00" or "10:00" on the common anode digital tube timing part; the 24 s timer displays "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 that has the ball in the game. 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. [page]
When the quarter reaches the last 10 minutes, the timer sends a signal to the buzzer, and the buzzer alarm prompts 1 second. At this time, the timer display panel changes from "00-10" to "10-00", and when the 24-second display panel changes to millisecond timing, it enters the 1/10 second countdown.
When the game ends, the buzzer alarm prompts 4 seconds, the timer panel timing part displays "00-00", and the 24-second display displays "00". At this time, the game ends. The flow chart is shown in Figure 2.
4 System debugging
4.1 Software debugging
Use Keil μVision 3 for simulation debugging, run the program according to the design requirements, debug the time, run the steps, etc., and finally debug to the parameters required by the design.
(1) After the program is compiled, check the code carefully line by line. Check the errors in the code, establish your own code checklist, and check the places where errors are often made. Check whether the code meets the programming specifications.
(2) Perform simulation tests on each subroutine. Simulation test method: Use the program to test the program, compile a code to call the subroutine, establish the entry conditions of the subroutine to be tested, and then see if it outputs the results as expected.
(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 single-chip microcomputer simulation and circuit board design software, set the parameters according to the design requirements after the basic circuit is connected, and then import the written program into the simulation hardware circuit, and then 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 power loss in the actual circuit, so these aspects must be considered when bridging the hardware circuit.
5 Precautions
(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 often necessary to pay attention to whether the model of the chip and switch tube, the polarity of the amplifier and switch tube, the withstand voltage and polarity of the capacitor, the resistance value and power of the resistor are consistent with the design drawings, and focus on checking whether there is a short circuit between the system bus or between the bus and other signal lines.
(2) Check whether the welding point is firm, especially carefully check whether there is leakage and wrong welding; for adjacent welding points that are very close, pay attention to check 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, you must pay attention to the fact 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 used to eliminate the impact of perfusion and peak current on the operation of the microcontroller.
6 Conclusion
AT89C51 simplifies the circuit, reduces the number of components, and makes the structure compact, which reduces the cost, improves the sensitivity and reliability, and conforms to the development trend of integration and modularization. At the same time, the timer has the advantages of simple time setting operation, complete functions, small size, and easy to carry. It can be widely used in schools, basketball clubs, gymnasiums or small groups as a timer for the schedule.
Previous article:Research on program-controlled switching power supply based on single-chip microcomputer control
Next article:Keil mode settings and programming matters
Recommended ReadingLatest update time:2024-11-17 03: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!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- 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
- Read the good book "Electronic Engineer Self-study Handbook" - First Look
- Can anyone confirm what device this is? Thanks!
- Renesas RL78 D1A has an error when assigning an unsigned short type variable to a floating point number
- Competition Sharing 3: RSL10 Bluetooth SoC BMM150 Geomagnetic Sensor Data Collection
- Understanding TMS320C6000 gel files
- NASA is going to build Wi-Fi on the moon? What do you think?
- How much does it cost to learn microcontrollers?
- Does anyone know linear system theory? Urgent! ! ! ! ! Thanks! ! ! !
- I have a question, STM32 drives a three-phase DC brushless controller to drive a DC brushless motor with Hall
- An employee was dissatisfied with being fired and used a "crawler" to delete company data