Design of portable basketball timer based on single chip microcomputer control

Publisher:YuexiangLatest update time:2011-10-11 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
0 Introduction
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.

a.jpg


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.

b.jpg



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.

Reference address:Design of portable basketball timer based on single chip microcomputer control

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

Method of Expanding High-Speed ​​Serial Synchronous Shift Output Port of AT89C51 Single-Chip Microcomputer
The serial port of the AT89C51 (compatible with MCS-51) microcontroller can expand multiple 8-bit parallel I/O ports using a shift register chip in mode 0. In the LED dot matrix display application system, the data synchronous shift output method is generally adopted, and the shift register chip (such as 74LS595) is u
[Microcontroller]
Method of Expanding High-Speed ​​Serial Synchronous Shift Output Port of AT89C51 Single-Chip Microcomputer
AT89C51 reset circuit
1. Basic reset circuit      The basic function of the reset circuit is to provide a reset signal when the system is powered on and to continue until the system power supply is stable. Cancel the reset signal. For reliability, the reset signal will be canceled after a certain delay after the power supply stabilizes. Th
[Microcontroller]
AT89C51 reset circuit
Solution of driving OLED display based on SSD1303 and AT89C51
1. Introduction Organic electroluminescent display (OLED) technology is the next generation of the most competitive flat panel display technology. At present, the research focus of OLED is to improve the stability of the device, the luminous efficiency and the driving technology of high-quality dynamic
[Microcontroller]
Solution of driving OLED display based on SSD1303 and AT89C51
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号