89c51数字秒表

来源:百度知道 编辑:UC知道 时间:2024/06/19 19:18:15
数字秒表系统,要求支持百分秒、秒、分数字显示,并且支持开始/结束、暂停、复位等按键控制功能。数据在数码管上显示 用的是89c51芯片 最好是汇编或者c语言

我编的一个数字秒表程序,不过只是显示到百分秒和秒,分的话你照着程序简单改下就好了!开始/结束、暂停、复位等按键控制功能通过INT0控制!
#include<reg51.h>
#define uchar unsigned char
unsigned char code timeshow[]={ 0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,0x88,0x83,0xC6,0xA1,0x86,0x8E};
unsigned char code timeshow1[]={0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x10,0x08,0x03,0x46,0x21,0x06,0x0E};
sbit minshi=P2^0;
sbit minge=P2^1;
sbit secshi=P2^2;
sbit secge=P2^3;
uchar min=0,second=0;
uchar timercounter=0;
uchar AN=0;
/*延时200us程序*/
void delay200us()
{
uchar i;
for(i=100;i>0;i++);
}
void delay()
{
uchar i,j;
for(i=200;i>0;i--)
for(j=250;j>0;j--);
}
void desply(uchar min, uchar second)
{
minshi=0;
P0=timeshow[min/10];
delay200us();
minshi=1;
minge=0;
P0=timeshow1[min%10];
delay200us();
minge=1;
secshi=0;
P0=timeshow[second/10];
d