Design of portable basketball timer controlled by single chip microcomputer

Publisher:DazzlingSpiritLatest update time:2011-08-19 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Block diagram of portable basketball timer system controlled by single chip microcomputer

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.

Software flow chart of portable basketball timer controlled by single chip microcomputer

[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.

Reference address:Design of portable basketball timer controlled by single chip microcomputer

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

Design of Automatic Temperature Measurement and Alarm System Based on AT89C51
At present, whether in industrial production or scientific research experiments, the equipment for automatic control through temperature measurement is becoming more and more popular, and there are more and more application occasions. The problem that follows is how to measure the accurate temperature to ensure that
[Test Measurement]
Design of Automatic Temperature Measurement and Alarm System Based on AT89C51
LPC1768 timer TIMER0
/*************************************************************************************       *   main.c:  the main file    *   NXP --  LPC1768   *   *      *   Author  :   light                      *   Date    :   2012-4-23     *   *   Email   :   lightwu@hotmail.com   **************************************
[Microcontroller]
Teach you how to write S12XS128 program (23) -- Timer register description 5
Timer Core Register (TCNT) Register offset: $0004-$0005 TCNT is an incremental counter that keeps counting the internal clock signal. The program can read it at any time, but writing is prohibited in normal mode. TCNT should be accessed by word. Accessing the high and low bytes separately may result in incorrect r
[Microcontroller]
Teach you how to write S12XS128 program (23) -- Timer register description 5
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 disp
[Microcontroller]
Serial interface and serial communication of single chip microcomputer (AT89C51)
Asynchronous and synchronous communication  Serial communication can be divided into asynchronous communication and synchronous communication according to the synchronization method. Asynchronous communication Asynchronous communication relies on start bits and stop bits to maintain communication synchronization.
[Microcontroller]
Serial interface and serial communication of single chip microcomputer (AT89C51)
MSP430 basic timer basic timer interrupt time calculation
I recently worked with 430 and was troubled by the BT timer. The BT timer is different from the ordinary timer of AVR that I have used before. The previous timer counted to FF and then generated an overflow interrupt. But the BT timer is different. The BT timer generates an interrupt when the corresponding selectio
[Microcontroller]
MSP430 basic timer basic timer interrupt time calculation
Design and simulation of LED Chinese character display screen based on AT89C51 single chip microcomputer
O Introduction LED display is a flat display screen composed of light-emitting diode dot matrix modules or pixel units. It has the advantages of high luminous efficiency, long service life, flexible configuration, rich colors and strong adaptability to indoor and outdoor environments. It is widely used for infor
[Microcontroller]
Design and simulation of LED Chinese character display screen based on AT89C51 single chip microcomputer
Research on Dual-CPU Servo Controller Based on AT89C51+DSP
1 Introduction In recent years, with the continuous progress of the manufacturing industry, modern manufacturing industry has increasingly higher requirements for precision, accuracy, high speed and automation. Most traditional motion controllers use 8051 series 8-bit single-chip microcomputers. Althoug
[Industrial Control]
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号