帮忙注释下 c 程序
程序太多,看不怎么懂,谁会的帮忙注释下#include <reg52.h> //加载C51核心库文件
#include <intrins.h> //加载应用型库文件
#define uchar unsigned char //宏定义无符号字符函数
#define uint unsigned int
uchar code duan_ma[]={0x81,0xcf,0x92,0x86,0xcc,0xa4,0xa0,0x8f,0x80,0x84};//共阳
uchar code wei_ma[]={0xfe,0xfd,0xfb,0xf7,0xef};
uchar data dx[3]={0x5,0x6,0x7};
uint count=2,jishu,flag;
uint Data=0,temp;
uchar t=0;
uchar m1=0;
uchar temp1;
uint temp,data_d=0;
sbit CLK=P3^3; //定义端口
sbit OE=P3^2;
sbit EOC=P3^1;
sbit ST=P3^0;
sbit en1=P3^6;
sbit s1=P3^4;
sbit s2=P3^5;
sbit ADD_Key=P2^5;
sbit SET_KEY=P2^6;
shucai();
void motor(uchar index,char speed)
{
if(speed<=100)
{
if(index==1)
{
m1=speed;
s1=1;
s2=0;
}
}
}
void delay(uint j)
{
uint k;
for(k = j;j>0;j--);
}
tik()
{
uint i;
dx[0]=data_d%10;
dx[1]=data_d/10%10;
dx[2]=data_d/100;
for(i=0;i<3;i++)
{
P2=wei_ma[i];
P0=duan_ma[dx[i]];
delay(120);
P2=0xff;
}
motor(1,data_d);
delay(5000);
}
void dishu()
{
if(ADD_Key==0)
{
delay(120);
while(ADD_Key==0);
data_d=data_d-10;
}
tik();
}
void tek()
{
uint i;
dx[0]=data_d%10;
dx[1]=data_d/10%10;
dx[2]=data_d/100;
for(i=0;i<3;i++)
{
P2=wei_ma[i];
P0=duan_ma[dx[i]];
delay(120);
//P2=0xff;
}
motor(1,data_d);
delay(5000);
}
void gaoshu()
{
if(ADD_Key==0)
{
delay(120);
while(ADD_Key==0);
data_d=data_d+10;
}
tek();
}
void shezhi()
{
if(SET_KEY==0)
{
flag=1;
while(SET_KEY==0);
flag=1;
count++;
jishu=count%3;
}
}
void disp()
{
uchar i,j;
temp=(uint)(Data*2.4/(0.013*255))-76;
data_d=temp;
motor(1,data_d);
dx[0]=temp%10;
dx[1]=temp/10%10;
dx[2]=temp/100;
for(j=0;j<200;j++)
{
for(i=0;i<3;i++)
{
P2=wei_ma[i];
P0=duan_ma[dx[i]];
delay(120);
}
}
}
shucai()
{
TR0=1;
ST=1;
_nop_();
_nop_();
ST=0;
_nop_();
_nop_();
while(EOC=0);
OE=1;
Data=P1;
OE=0;
TR0=0;
}
maichong()
{
TMOD=0x22;
TH0=0xff;
TL0=0xff;
TH1=0x00;
TL1=0x00;
EA=1;
ET0=1;
ET1=1;
TR1=1;
}
main()
{
maichong();
while(1)
{
shezhi();
if(flag==1)
{
switch(jishu)
{
case 0:
//tek();
gaoshu();
break;
case 1:
//tik();
dishu();
break;
case 2:
shucai();
disp();
break;
default :break;
}
}
else
{
shucai();
disp();
}
}
}
void timeT0() interrupt 1
{CLK=~CLK; }
void timeT1() interrupt 3
{
if(t==0)
{temp1=m1;}
if(t<temp1) en1=1;
else
en1=0;
t++;
if(t>=100) t=0;
}