Newsletter

Design of Basketball Scoreboard Based on 51 MCU-IT Blog

1. Design tasks

Design a basketball scoreboard based on MCU to realize the scoring function of two teams and the 24-second timing function.

2. Requirements for performance indicators

(1) Independently design the circuit required by the system according to the requirements of the subject, and complete the production and debugging of the hardware circuit.

(2) Combined with hardware, it can score normally (1, 2, 3).

(3) The score can be displayed normally.

(4) The working mode can be modified normally (scoring and 24 seconds).

(5) The error of 24 seconds is not less than 1 second.

Extended section

Can record the number of fouls counted by players of both teams.

3. Design ideas and design block diagram

1. Design ideas

We use AT89C52 as the chip for this training, and use keil to program in C language at the same time, and the generated HEX file is imported into AT89C52 through the download port.

There is a 12M crystal oscillator in the device and it is connected with the pins corresponding to the chip, and the clock signal generated by the crystal oscillator is used as the timing signal. The basketball scoreboard is divided into three parts: switch control, digital tube display and warning circuit. The P1 port is connected to 8 buttons, which are used as display switching, second timing, and foul counting. Ports P0 and P2 are respectively connected to the segment selection and bit selection of the digital tube.

Mainly used in basketball games to record the 24-second timing, foul count and display the score of the two teams in the game.

Overall design block diagram:

Part of the program:

#include
unsigned int smg[] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
unsigned int t = 0, fs1 = 0, fs2 = 0, fg1 = 0, fg2 = 0, q2 = 0, q3 = 0;
unsigned int m = 24;

sbit led = P3 ^ 3;
sbit fmq = P3 ^ 2;

void delay(unsigned int t)
{
unsigned int i,j;
for(i = 0;i < 200;i++)
for(j = 0;j < t;j++);
}
void t_0()    interrupt 1
{
TH0 = 0X3C;
TL0 = 0XB0;
t++;
if(t == 20)
{
t = 0;
m–;
}
}

void xyh()
{
P2 = 0xfb;
P0 = smg[fs1%10];
delay(1);
P2 = 0xf7;
P0 = smg[fs1/10];
delay(1);
P2 = 0xfe;
P0 = smg[fs2%10];
delay(1);
P2 = 0xfd;
P0 = smg[fs2/10];
delay(1);
}
void xz()
{
if (P1==0x7f)
{
delay (10);
if (P1==0x7f)
{
q2 += 1;
if(q2 > 1)
{
q2 = 0;
}
while(P1==0x7f);
}
}
if(P1==0xbf)
{
delay (10);
if(P1==0xbf)
{
q3 += 1;
if(q3 > 1)
{
q3 = 0;
}
while (P1==0xbf);
}
}
}
void xs()
{
if(q2==0)
{
if(q3==1)
{
led = 1;
P2 = 0xfb;
P0 = smg[fs1%10];
delay(1);
P2 = 0xf7;
P0 = smg[fs1/10];
delay(1);
P2 = 0xfe;
P0 = smg[fs2%10];
delay(1);
P2 = 0xfd;
P0 = smg[fs2/10];
delay(1);
}
else
{
led = 0;
P2 = 0xfb;
P0 = smg[fg1%10];
delay(1);
P2 = 0xf7;
P0 = smg[fg1/10];
delay(1);
P2 = 0xfe;
P0 = smg[fg2%10];
delay(1);
P2 = 0xfd;
P0 = smg[fg2/10];
delay(1);
}
}
else
{
P2 = 0xfd;
P0 = smg[m/10];
delay(1);
P2 = 0xfe;
P0 = smg[m%10];
delay(1);
}
}

Reference circuit:

Data content:

All required information can be downloaded from the resource.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Trending