c语言程序的含义
#include<reg52.h> /头文件....................
补充:#include<reg52.h>
#include<pub.h>
void main()
{
init();
for(;;);
}
void init()
{
EA=1;
ET0=1;
TMOD=0X01;
TH0=0XFC;
TL0=0X66;
TR0=1;
}
void tim0() interrupt 1
{
static unsigned int t=0;
TH0=0XFC;
TL0=0X66;
t++;
if((t==1000)&(mode==0))
jia();
if((t%500==0)&(mode==0))
led=~led;
led_js();
shang(t);
chushi(t%4);
key();
if(t==1000)t=0;
}
#ifndef __pub_h__
#define __pub_h__
#define duan P2
#define wei P0
void chushi(char i);
sbit led=P1^7;
unsigned char code led_zx[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff};
unsigned char led_str[4]={0,0,0,0};
void js();
#define iokey P1
sbit key1=P1^0;
sbit key2=P1^1;
sbit key3=P1^2;
void key();
void actkey(unsigned char k);
void init();
char miao=0;
char fen=10;
char shi=12;
char mode=0;//模式
void moshi();
void shang(unsigned int t);//调时间选中的分或时在1s内前300毫秒灭后700毫秒亮
void chushi(char i)
{
duan=0xff;
wei=~(1<<i);
duan=led_zx[led_str[i]];
}
void led_js()
{
led_str[3]=fen%10;//分的个位
led_str[2]=fen/10;//分的十位
led_str[1]=shi%10;//时的个位
led_str[0]=shi/10;//时的十位
}
void jia()
{
miao++;
if(miao>=60)
{
miao=0;fen++;
}
if(fen>=60)
{
fen=0;shi++;
}
if(shi>=24)
shi=0;
}
void shang(unsigned int t)
{
if(t<300)
{
if(mode==1)//调分
{
led_str[2]=10;
led_str[3]=10;
}
if(mode==2)//调时
{
led_str[0]=10;
led_str[1]=10;
}
}
}
void key()//按键识别程序
{
static unsigned char tim=0;
static unsigned char kv=0;
key1=1;key2=1;key3=1;
if(!(key1&key2&key3))//按键按下
{
tim++;
if(tim>=21)
tim=21;
if(tim==20)
kv=iokey|0xf8;
}
else//按键抬起
{
actkey(kv);
kv=0;
tim=0;
}
}
void moshi()//mode=0正常状态 mode=1调分状态 mode=2调时状态
{
mode++;
if(mode==3)
mode=0;
}
void actkey(unsigned char k)//按键功能程序
{
switch(k)
{
case 0xfe: moshi(); break;
case 0xfd: if(mode==1) fen++;
if(fen==60)fen=0;
if(mode==2) shi++;
if(shi==24)shi=0;
break;
case 0xfb: if(mode==1) fen--;
if(fen==-1)fen=59;
if(mode==2) shi--;
if(shi==-1)shi=23;
break;
}
}
追问:我要的是每句的含义