目录
- 基于51单片机的秒表系统
- 一、原理图
- 二、部分代码
- 三、视频演示
基于51单片机的秒表系统
一、原理图
二、部分代码
#include <reg52.h>
#define duanxuan P2
#define weixuan P1
unsigned char code wxcode[]={0X01, 0x02, 0x04, 0x08, 0X10, 0X20, 0X40, 0X80};
unsigned char code dxcode[]={0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f,
0xBF, 0X86, 0XDB, 0XCF, 0XE6, 0XED, 0XFD, 0X87, 0XFF, 0XEf};
unsigned char tab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,
0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x10,
0xbf,0xff};// 0-9 '-' '全关'
//中断1ms变量 -> 产生10ms 中断
unsigned char ms_1 = 0;
//四位数码管数据
unsigned char ms_10 = 0;
unsigned char m_1 = 0;
unsigned char f_1 = 0;
unsigned char s_1 = 0;
void Timer0Init(void);
void DigDisplay();
void INT0_Init(void);
void INT1_Init(void);
void main()
{
INT0_Init();
INT1_Init();
Timer0Init();
while(1)
{
DigDisplay();
}
}
三、视频演示
哔哩哔哩视频演示链接跳转,请直接点击!