使用TM4C123G控制RX8025,通过I2C设置时钟时(reg_addr 0x00-0x06),总是漏发前三个数据,加上串口调试后就没有这个问题,这是怎么回事?请教一下各位大神
写寄存器:
int RX8025_write(uint8_t reg_addr, uint8_t reg_data)
{
// 绑定从地址, 主模块发送
I2CMasterSlaveAddrSet(I2C2_BASE, SLAVE_ADDRESS, false);
I2CMasterDataPut(I2C2_BASE, reg_addr<<4);
I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_START);
while(I2CMasterBusy(I2C2_BASE));
I2CMasterDataPut(I2C2_BASE, reg_data);
I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_CONT);
while(I2CMasterBusy(I2C2_BASE));
I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_STOP);
while(I2CMasterBusy(I2C2_BASE));
// UartSend(®_data, 1);
return 0;
}
调用:
for (regdata_index=0; regdata_index<7; regdata_index++)
{
RX8025_write(regdata_index, time_temp[regdata_index]);
}
本帖最后由 yisEEW 于 2018-3-1 10:18 编辑