51单片机按键控制数码管加减和秒表


#include
#define uchar unsigned char
#define uint unsigned int
 
sbit k1=P3^4;
sbit k2=P3^5;
sbit k3=P3^6;
sbit k4=P3^7;
sbit du=P2^6;
sbit we=P2^7;
uchar counter,num;
uchar code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
                    0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71 };//数码管的段选

 
uchar code list[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};//数码管的位选
 
void delay_ms(uint ms)
{
	uint i;
	uint j;
    for(i=0;i

你可能感兴趣的:(学习笔记)