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.
你的波形有2个问题
1. 这个波形中,第8个CLK是用来指示读、写命令的,0表示写,1表示读。在本波形中是写操作,而不是读操作。说明你在I2CReadInit函数中,没有把UCBXCTL1的UCTR置0.
2. 即使是写操作,在本波形中第9个CLK时,从设备也没有给出ACK信号。说明你写的设备地址有问题。你可以把你从设备的地址描述部分贴出来看下。
// USCI_B0 Data ISR
// Notice : UCSIAB0RX_ISR should be handle with UCSIAB0TX_ISR
#pragma vector = USCIAB0TX_VECTOR
__interrupt void USCIAB0TX_ISR(void)
{
if (IFG2 & UCB0TXIFG) // TX
{
UCB0TXBUF = I2CSendBuffer[I2CSendPtr]; // Load TX buffer
I2CSendPtr--; // Decrement TX byte counter
if (I2CSendPtr < 0) {
while (!(IFG2 & UCB0TXIFG)); // wait for tx complete
IE2 &= ~UCB0TXIE; // disable interrupts.
IFG2 &= ~UCB0TXIFG; // Clear USCI_B0 TX int flag
}
}
if (IFG2 & UCB0RXIFG) // RX
{
I2CRecvBuffer = UCB0RXBUF; // store received data in buffer
}
__bic_SR_register_on_exit(LPM0_bits);
}
这个是中断