请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:MSP430F5418A 我知道这是一个简单的 I2C 代码-但我想知道是否有任何示例?
谢谢、
梅希
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.
我知道这是一个简单的 I2C 代码-但我想知道是否有任何示例?
谢谢、
梅希
您好、Mechi、
很抱歉,我们没有您需要的示例,我们只提供了一些 I2C 示例代码供您参考:
https://dev.ti.com/tirex/explore/node?node=AO-GzKi3iE5i6eQjp3ACig__IOGqZri__LATEST
此致
Johnson
我需要无中断的代码-
与 MSP430 DevWare 中的代码类似:
bool USCI_B_I2C_masterSendMultiByteFinishWithTimeout (uint16_t baseAddress、 uint8_t txData、 uint32_t 超时) { uint32_t timeout2 =超时; //如果未使用中断,则轮询标志 if (!(HWREG8 (baseAddress + OFS_UCBxIE)& UCTXIE)) { //轮询发送中断标志。 while ((!(HWREG8 (baseAddress + OFS_UCBxIFG)& UCTXIFG))&&-超时) { ; } //检查传输是否超时 if (超时=0) { 返回(status_fail); } } //发送单字节数据。 HWREG8 (baseAddress + OFS_UCBxTXBUF)= txData; //轮询发送中断标志。 while ((!(HWREG8 (baseAddress + OFS_UCBxIFG)& UCTXIFG))&-timeout2) { ; } //检查传输是否超时 if (timeout2 = 0) { 返回(status_fail); } //发送停止条件。 HWREG8 (baseAddress + OFS_UCBxCTL1)|= UCTXSTP; return (status_Success); }
您好、Mechi、
很抱歉稍后回复您、对于 I2C 示例代码、您可以参阅此链接、也可以尝试使用寄存器级别:
https://dev.ti.com/tirex/explore/node?node=AAlYA4O0NtpJRj5pWT3-Ow__IOGqZri__LATEST
此致
Johnson