51单片机在做红外遥控的实验过程中,在外部中断0函数中接收四个字节的数据,(程序如下:),我的疑问是,在接收数据的过程中产生的下降沿,会再次引发外部中断0的中断么?从实验现象猜测来看是不会的,有点不理解?//外部中断0触发函数如下:下降沿触发
- void GetDateToIr() interrupt 0
- {
- u8 i, j;
- u8 Byte;
- u16 time;
-
- //1.判断起始码低电平9ms
- time = GetLowTime();
- if( (time<8500) || (time>9500) )//8.5ms<time<9.5ms
- return ;
- //2.判断起始码高电平4.5ms
- time = GetHighTime();
- if( (time<4000) || (time>5000) )//4.0ms<time<5.0ms
- return ;
-
- //3.接收4Byte数据
- for(i=0; i<4; i++)
- {
- for(j=0; j<8; j++)
- {
- time = GetLowTime();
- if( (time<340) || (time>780) )//低电平 340us<time<780us
- return ;
-
- time = GetHighTime();
- if( (time>340) && (time<780) )//表明这是一个“0”
- {
- Byte >>= 1;
- }else if( (time>1500) && (time<1900) )//1.5ms<time<1.9ms
- {
- Byte >>= 1;
- Byte |= 0x80;
- }else
- return ;
- }
- IfredValue[i]=Byte;
- }
- }
复制代码
|