慧净电子吧 关注:448贴子:1,233
  • 0回复贴,共1

为什么中断函数count==500时,开发板LED延时是5秒,不是500ms

取消只看楼主收藏回复

static int count = 0;
void main(){
SMW = 1;
SMW = 0;
SMD = 1;
SMD = 0;
TMOD = 0x01;//T0定时器模式1
TL0 = 0xCC;
TH0 = 0xD4;
TR0 = 1;//开始计时
EA = 1;
ET0 = 1;//外部定时器中断开
while(1) {
}
}
void time_0() interrupt 1 using 1{
count++;
TL0 = 0xCC;
TH0 = 0xD4;
if(count == 500 ){
count = 0;
L7 = ~L7;
}
}


1楼2023-07-11 20:51回复