以下是同学写的程序,小弟单片机知识匮乏,又崔得比较急,请高手帮忙修改,跟同学的有所区别,能应付交差就行。不胜感激!(希望在关键步骤后稍加注释,谢谢了)
# include < reg52.h>
typedef unsigned char byte
byte count.low
byte count.high
int count_value
void clock0_initial ( ) reentrant using 0
{ TCON=0X00;
TH0=0X00;
TL0=0X00;
TR0=1;
}
void count_module (byte a )
{do
{ count_high=TH0;RESETCS=1;
} while (count_high!=TH0);
}
Void main ()
{ TMOD=0x05;
clock0_initial ( );
ET0=1;
EA=1;
do { count_module (1); } P1=CNT=> 8;P2=CNT;
while (1); }
void clk_int(void) interrupt 1 using 0
{ count_value=count_value+1;
clock1_initial (1);
}