# 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;count_low=tl0;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);
}
发表时间:2004年8月28日16:49:14