基于STM32单片机的篮球计时记分器proteus仿真原理图PCB

功能:
0.本系统采用STC89C52作为单片机
1.LCD1602液晶实时显示比赛剩余时间,球队分数
2.默认计时器为4节,每节10分钟,每节比赛结束,蜂鸣器报警
3.按键功能介绍:
'1’键——加1分 '4’键——减1分
'2’键——加2分 '5’键——减2分
'3’键——加3分 '6’键——减3分
'0’键——关闭蜂鸣器
'*'键——启动/暂停计时器
'#'键——复位计分器
'A’键——选择A队 'B’键——选择B队
'C’键——初始状态下计时器加1分钟
'D’键——初始状态下计时器减1分钟
4.采用DC002作为电源接口可直接输入5V给整个系统供电

原理图:
在这里插入图片描述

PCB :
在这里插入图片描述

主程序:

#define __MAIN_C
#include "main.h"
#include "stm32f10x.h"
#include "stm32f10x_gpio.h"
#include "bsp_gpio.h"
#include "bsp_clkconfig.h"
#include "bsp_delay.h"
#include "bsp_lcd1602.h"
#include "bsp_GeneralTim.h" 
#include "bsp_keyArray.h"
#include "stdio.h"

CreatByte Flag;

uint8_t roundNum = 1;
uint8_t scoreA = 0;
uint8_t scoreB = 0;
volatile uint8_t timeMinute = 0;
volatile uint8_t timeSecond = 0;
volatile uint8_t time10ms = 0;
uint8_t setTimeMinute = 10;

int main(void)
{	
    char dis[16] = {0};
    dispFlag = 1;
    startFlag = 0;
    teamFlag = 0;
    timeMinute = setTimeMinute;
    
    // 使用HSI,SYSCLK = 4M * RCC_PLLMul_x, x:[2,3,...16],最高是64MH
    HSI_SetSysClock(RCC_PLLMul_2); //使用内部8MHz晶振,并设置PLL输出为8MHz

    // LED 端口初始化
    GPIO_Config();
    GENERAL_TIM_Init();
    KeyArray_GPIO_Init();
    
    LCD_GPIO_Init();
    LCD_Init();
    LCD_Clear();
    DelayMs(250);
    LCD_DispStr(0, 0, "    Welcome!    ");
    DelayMs(2000);
    LCD_Clear();
    
    
    while (1)
    {    
        if (dispFlag == 1)
        {
            dispFlag = 0;
            sprintf(dis, "R:%1d  T:%02d:%02d:%02d", (int)roundNum, (int)timeMinute, (int)timeSecond, (int)time10ms);
            LCD_DispStr(0, 0, dis);
            DelayMs(10);
            if (teamFlag == 0)
            {
                sprintf(dis, ">A  %03d--%03d  B ", (int)scoreA, (int)scoreB);
                LCD_DispStr(0, 1, dis);
            }
            else
            {
                sprintf(dis, " A  %03d--%03d >B ", (int)scoreA, (int)scoreB);
                LCD_DispStr(0, 1, dis);
            }
        }
        
        KeyFunction();
    }
}

/*********************************************END OF FILE**********************/

仿真演示视频:
https://www.bilibili.com/video/BV1cN4y1P7cZ/

实物演示视频:
https://www.bilibili.com/video/BV1pY4y167dj/

  • 1
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值