This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

I2C程序放入协议栈就读不出来数据

adxl345,裸机跑是没问题的,放入协议栈就读不出来,换了很多IO,也换过延时函数,都读不出来,实在没办法了。

这是我用的几个延时:

void Delayus(unsigned int k)//us延时函数
{
T1CNTL=0;
T1CNTH=0;
T1CC0L = 32;
T1CC0H = 0x00;
T1CTL = 0x02; //模,从0x0000到T1CC0反复计数。
while(k)
{
while(!(T1CNTL >= 25));//定时器的低字节计数
k--;
}
T1CTL = 0x00; //关闭定时器
}
*/

//*************************************************************************************************

/*
void Delayus(unsigned int k)
{
k>>= 1;
while(k--)
{
asm("NOP");asm("NOP");asm("NOP");asm("NOP");
asm("NOP");asm("NOP");asm("NOP");asm("NOP");
asm("NOP");asm("NOP");asm("NOP");asm("NOP");
asm("NOP");asm("NOP");asm("NOP");asm("NOP");
asm("NOP");
}
}
*/

//*************************************************************************************************

void Delayus(unsigned int k) //us延时
{
MicroWait(k);
}