写出下列程序的注释,并说明各个子程序实现的功能
第一个
static int delayLoopCount=400;
void Delay(int time)
{
int i,adjust=0;
if(time==0)
{
time=200;
adjust=1;
delayLoopCount=400;
rWTCON=((MCLK/1000000-1)<<8)|(2<<3);
rWTDAT=0xffff;
rWTCNT=0xffff;
rWTCON=((MCLK/1000000-1)<<8)|(2<<3)|(1<<5);
}
for(;time>0;time--)
for(i=0;i
if(adjust==1)
{
rWTCON=((MCLK/1000000-1)<<8)|(2<<3);
i=0xffff-rWTCNT; delayLoopCount=8000000/(i*64); }
}
第二个
2 void Port_Init(void)
{ rPCONA = 0x1ff;
rPDATB = 0x3ff;
rPCONB = 0x3ff;
rPDATC = 0xffff;
rPCONC = 0x0f00ff54;
rPUPC = 0x3000;
rPDATD= 0xff;
rPCOND= 0xaaaa;
rPUPD = 0x0;
rPDATE = 0x1ff;
rPCONE = 0x15569;
rPUPE = 0x6;
rPDATF = 0x0;
rPCONF = 0x24900a;
rPUPF = 0x1e3;
rPDATG = 0xff;
rPCONG = 0xffff;
rPUPG = 0x0; //should be enabled
rSPUCR = 0x7; //D15-D0 pull-up disable
rEXTINT = 0x0 | (4<<4) | (4<<8) | (4<<12);
}
第三个
3 void Timer_Start(int divider)
{
rWTCON=((MCLK/1000000-1)<<8)|(divider<<3);
rWTDAT=0xffff;
rWTCNT=0xffff;
rWTCON=((MCLK/1000000-1)<<8)|(divider<<3)|(1<<5);
}
int Timer_Stop(void)
{
rWTCON=((MCLK/1000000-1)<<8);
return (0xffff-rWTCNT);
}
要上交了 我搞不懂 很急 希望各位高手帮帮忙