定时中断有很多不懂得问题哦!!
搂主详细的解释一下我的这个计算计数初值的公式是怎么来的呢??
TH0=-(1000/256); /*预置计数初值*/
TL0=-(1000%256);
为什么一个是/,一个是%
还有如果是用
void Timer0ISR(void) interrupt 1 using 3 这个函数,可以知道使用定时器1在计时,但是多久计一次呢??
他接下来的程序是:
{unsigned char tmp,tmp_days;
count_down--;
if(count_down==1 || count_down==2001 || count_down==4001 || count_down==6001)
{ flash=~flash; //数码管闪烁的开关量
if(sound && flash) sound_output=0; //驱动蜂鸣器
else sound_output=1; //关闭蜂鸣器
return;
}
count_down前面有定义过,但是好像都不知道他的初值是多少,怎么会--之后就变成1或2001或4001了呢??
发表时间:2006年7月18日22:41:18