21ic问答首页 - CC2640的I2C问题请教
CC2640的I2C问题请教
flycamelaaa2020-12-08
我用CC2640 的I2C 模块给OPT3001光照芯片 写值,发现写不进去。该芯片寄存器是16位的,咱I2C模块可以写16位寄存器的值吗???
我就想给0x01寄存器写个0x54,0x10,代码如下:
void Set_OPT3001(uint8_t limit)
{
Reset_OPT3001_Register();
txBuffer[0] = 0x54;txBuffer[1] = 0x10;
i2cTrans.writeCount = 3;
i2cTrans.writeBuf = txBuffer;
i2cTrans.readCount = 0;
i2cTrans.readBuf = rxBuffer;
i2cTrans.slaveAddress = 0x44;
I2C_transfer(handle, &i2cTrans);
}
我就想给0x01寄存器写个0x54,0x10,代码如下:
void Set_OPT3001(uint8_t limit)
{
Reset_OPT3001_Register();
txBuffer[0] = 0x54;txBuffer[1] = 0x10;
i2cTrans.writeCount = 3;
i2cTrans.writeBuf = txBuffer;
i2cTrans.readCount = 0;
i2cTrans.readBuf = rxBuffer;
i2cTrans.slaveAddress = 0x44;
I2C_transfer(handle, &i2cTrans);
}
赞0
老哥,这是啥例程啊
评论
2022-08-18
赞0
评论
2020-12-09
赞0
评论
2020-12-09
赞0
建议用逻辑分析仪观察一下时序看看,但看楼主的程序看不出什么
评论
2020-12-09
您需要登录后才可以回复 登录 | 注册