Board logo

标题: 两个函数 [打印本页]

作者: 微毫度十分个扩大飞机公婆    时间: 2007-4-29 23:13     标题: 两个函数

如果在接受到一个数据包时测的A==MLMEEnergyDetect(),
B==MLMELinkQuality (),
A和B有什么异同??


即以下两个函数有何异同??

/*
* PLMEEnergyDetect : Measure channel energy.
*
* Parameters : None
*
* Return : Energy
*/
UINT8 PLMEEnergyDetect (void)
/* Note: Actual power returned is: -(power/2) */
/* Global calibration required for accuracy. */
{
UINT16 u16Reg;
UINT8 u8Power;

gu8RTxMode = CCA_MODE; /* Write energy detect mode */
u16Reg = SPIDrvRead(MODE_ADDR);
u16Reg &= 0xFFF8;
u16Reg |= CCA_MODE;
SPIDrvWrite(MODE_ADDR, u16Reg);
RTXENAssert();
while (gu8RTxMode != IDLE_MODE) /* Wait for energy detect to complete */
{
MCU_LOW_POWER_WHILE();
}
u16Reg = (SPIDrvRead(CCA_RESULT_ADDR) & 0xFF00);
u8Power = (u16Reg >> 8);
return u8Power;
}


/*
* PLMELinkQuality : Report energy from last successful RX packet.
*
* Parameters : None
*
* Return : Energy
*/
UINT8 PLMELinkQuality (void)
/* Note: Actual power returned is: -(power/2) */
/* Global calibration required for accuracy. */
{
UINT16 u16Reg;
UINT8 u8Power;

u16Reg = SPIDrvRead(CCA_RESULT_ADDR);
u8Power = ((u16Reg & 0xFF00) >> 8);
return u8Power;
}

作者: seuafu2005    时间: 2007-4-30 14:44

energy detect是测信道质量的
LQI才是测包的质量




欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) Powered by Discuz! 7.0.0