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.
UCB0I2CSA=WRITEADDR; // Slave Address is 38h
//while(UCB0CTL1&UCTXSTT); // Ensure stop condition got sent
UCB0CTL1 |=UCTXSTT; // I2C TX, start condition
UCB0CTL1 |=UCTR;
为什么执行完这些语句后,UCB0TXIFG没有置为是什么原因呀?
1.请把初始化代码发上来,这个代码局部很难找到问题
2.置UCB0TXIFG是在发送slave地址之后,则等待往UCBxTXBUF中写数据(等待时间过长会造成clock stretch),然后判断ACK,如果有ACK,然后置UCB0TXIFG,NACK则置UCNACKIFG。
3.建议这样写这两句话:
UCB0CTL1 |=UCTR;
UCB0CTL1 |=UCTXSTT; // I2C TX, start condition