中级会员
 
- 积分
- 311
- 金钱
- 311
- 注册时间
- 2011-8-15
- 在线时间
- 33 小时
|

楼主 |
发表于 2011-8-17 13:02:57
|
显示全部楼层
回复【10楼】正点原子:
那就有问题了.
总之你看看延时是否准确先.
---------------------------------
我把检测脉宽的延时去掉了,一进中断就输出一个值,然后就break,中断的其他内容都屏蔽了,我看了一下,就只输出了4次,说明中断就4次
intrrupt_cunt就增加了4次;完全不对啦
static u8 intrrupt_cunt =0 ;
u8  ulse_Width_Check(void)
{
u8 t=0;
intrrupt_cunt ++;
while(RDATA) ;
return t;
}
void EXTI1_IRQHandler(void)
{
u8 res=0;
u8 OK=0;
u8 RODATA=0;
while(1)
{
if(RDATA)//有高脉冲出现
{
res=Pulse_Width_Check();//获得此次高脉冲宽度
printf("intrrupt_cunt = %d \n",intrrupt_cunt);
break;
}
}
EXTI-> R=1<<1; //清除中断标志位
}
|
|