求教一个中断例程的问题!!
[size=3][size=3][size=2][size=3][size=3][size=4]下面这段程序执行后,tl1和th1是递增的,导致死循环,我若要tl1,th1递减,
应如何修改?!各位大侠帮帮忙!3x!
void main(void)
{
int fgled1off,fgled2on,fgled2off,fgled3on,fgchange,ledoffcount;
initialcpuio();
ie = 0; //disable all interrupt
ip = 0x0b; //hi priority:int0,count0,timer1
tmod= 0x15; //set timer1:mode1 16 bit timer,timer0:counter0
tl1 = clock_40ms & 0xff; //timer1:40ms
th1 = clock_40ms > > 8;
led1on( );
// fgled2on = 0;
fgchange = 0;
et1 = 1; //enable timer1 interrupt
ea = 1; //enable all interrupt
tr1 = 1;
ledoffcount=time_5sec;
while( 1 )
{
if ( fgchange==0 )
{
if(ledoffcount==0)
{
fgchange=1;
led1off();
}
}
}
}
void ledoff_time1isr (void) interrupt 3 using 2
{
int timer40mscount=0;
int ledoffcount;
tl1=clock_40ms & 0xff;
th1=clock_40ms > > 8;
tf1=0;
timer40mscount++;
if (ledoffcount !=0)
ledoffcount--;
}[/size][/size][/size][/size][/size][/size]
发表时间:2003年7月29日17:20:38