本帖最后由 FSL_TICS_A 于 2014-7-2 15:46 编辑
芯片是KL25Z128,为什么用PE生成的I2C流数据读取信号,每次只能读到1个字节数据就发个停止位终结了呢?代码如下,子函数全部由PE生成:
void temp_ctrl(void)
{
//设置温度低阀值寄存器
I2C_Enable(I2C_DeviceData);
user_delay_1ms(5);
I2C_SelectSlaveDevice(I2C_DeviceData, LDD_I2C_ADDRTYPE_7BITS, (0x90>>1));
user_delay_1ms(5);
tmp_send_buffer[0] = TMP_TEMP_ADDRESS;
I2C_MasterSendBlock(I2C_DeviceData, tmp_send_buffer, 1U, LDD_I2C_SEND_STOP);
user_delay_1ms(5);
I2C_Disable(I2C_DeviceData);
user_delay_1ms(5);
//设置温度低阀值寄存器
I2C_Enable(I2C_DeviceData);
user_delay_1ms(5);
I2C_SelectSlaveDevice(I2C_DeviceData, LDD_I2C_ADDRTYPE_7BITS, (0x91>>1));
user_delay_1ms(5);
I2C_MasterReceiveBlock(I2C_DeviceData, tmp_recv_buffer,2, LDD_I2C_SEND_STOP);
user_delay_1ms(50);
I2C_Disable(I2C_DeviceData);
user_delay_1ms(5);
}
|