利用SMAC提供的源代码,当我用MLMERXEnableRequest(&rx_packet,0);开启接收器后,程序在执行过程中以比较高的频率进入void interrupt IRQIsr(void);读出的状态是0x0080,满足 ((u16StatusContent & RX_IRQ_MASK) != 0)及(u8DataLength < 3)的条件.如下程序所示
if ((u16StatusContent & RX_IRQ_MASK) != 0)
{
RTXENDeAssert(); /* Forces the MC13192 to idle. */ if ((u16StatusContent & CRC_VALID_MASK) == 0) { /* If an invalid CRC, restart receiver. */ /* Read the MC13192 trx register. Timer trigger off. */ u16StatusContent = (SPIDrvRead(MODE_ADDR) & 0xFF7F); /* Update the trx register */ SPIDrvWrite(MODE_ADDR, u16StatusContent); RTXENAssert(); /* Forces the MC13192 to enter the receive mode. */ return; } else { /* Read received packet length register and mask off length bits */ u8DataLength = (UINT8) (SPIDrvRead(RX_PKT_LEN) & 0x7F); if (u8DataLength < 3) /* Rx_pkt_length is bad when <3 because of CRC */ { /* Read the MC13192 trx register. Timer trigger off. */ u16StatusContent = (SPIDrvRead(MODE_ADDR) & 0xFF7F); /* Update the trx register. */ SPIDrvWrite(MODE_ADDR, u16StatusContent); /* Forces the MC13192 to enter the receive mode. */ RTXENAssert(); return; } /* A valid packet has been received. */ gu8RTxMode = IDLE_MODE; /* Set the rtx_state to idle */ SPIDrvWrite(T1_HI_ADDR, 0x8000); /* * Disables TC1 and clears the * IRQ. */ SPIDrvWrite(T1_LO_ADDR, 0x0000); RAMDrvReadRx(); printTRXBuffer(1); //RxBuffer中的数据打印 return; }
所以每次它都在做无为的工作,这种情况大大影响我的执行效率,这是怎么回事呢?我怎么能够让它在真的有数据的情况下才进入IRQIsr(). |