liufeng10101 发表于 2011-1-3 09:10:56

430读写TSL2561,

unsigned char ADCResult;
unsigned int ReadADCResult(void) //ADC结果是channel 0
{
unsigned char luxh;
unsigned char luxl;
WriteByte(0x81,0x02);//gain(1x),integration time of 402ms
WriteByte(0x86,0x00);//interrpt is level style, every ADC cycle generate one interrupt.
   WriteByte(0x80,0x03);
delay();
luxl=ReadByte(0x8C);
I2C_SetACK();
luxh=ReadByte(0x8D);
I2C_SetNAK();
ADCResult=luxh*256+luxl;
//return(ADCResult);
}

luxl,luxh编译出现 a value of type "void" cannot be assigned to an entity of type "unsigned char"怎么回事啊

wanpujame 发表于 2011-1-3 10:53:14

你看看你的 ReadByte() 函数是不是定义成了 void ReadByte() 了,应改为 unsigned char ReadByte()。

liufeng10101 发表于 2011-1-3 15:38:56

谢谢 已经解决

liufeng10101 发表于 2011-1-25 09:11:16

不过值为什么显示老是错误 请大家帮办忙

nktxsj 发表于 2011-3-17 19:43:06

回复【楼主位】liufeng10101
-----------------------------------------------------------------------

楼主能否给一下读数据的函数?我也一直在做,可是一直读不出数据,另外给说一下在SCL高低时候的延时行吗?
万分感谢!
页: [1]
查看完整版本: 430读写TSL2561,