求各位大神帮看看
我只会弄清零的- -
怎么累加啊!!
#include<reg51.h>
#define uchar unsigned char
#define uint unsigned int
uchar code DSY_CODE[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x00};
uchar DSY_Buffer[]={0,0,0};
uchar Count=0;
sbit Clear_Key=P3^6;
void Show_Count_ON_DSY()
{
DSY_Buffer[2]=Count/100;
DSY_Buffer[1]=Count%100/10;
DSY_Buffer[0]=Count%10;
if(DSY_Buffer[2]==0)
{
DSY_Buffer[2]=0x0a;
if(DSY_Buffer[1]==0)
DSY_Buffer[1]=0x0a;
}
P0=DSY_CODE[DSY_Buffer[0]];
P1=DSY_CODE[DSY_Buffer[1]];
P2=DSY_CODE[DSY_Buffer[2]];
}
void main()
{
P0=0x00;
P1=0x00;
P2=0x00;
IE=0x81;
IT0=1;
while(1)
{
if(Clear_Key==0) Count=0;
Show_Count_ON_DSY();
}
}
void EX_INT0() interrupt 0
{
Count++;
}
怎么改啊 (┬_┬) |