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.

[参考译文] CCS/MSP430FR6989:MSP430FR6989

Guru**** 2387080 points
Other Parts Discussed in Thread: MSP430FR6989
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/908407/ccs-msp430fr6989-msp430fr6989

器件型号:MSP430FR6989

工具/软件:Code Composer Studio

您好!  

这个特定的问题来自 MSP430FR6989的 driverlib 中 UART 驱动程序的用法。

相关文件为 eusci_a_uart.c 和 eusci_a_uart.h

查看发送数据函数的代码

void EUSCI_A_UART_transmitData (uint16_t baseAddress、
uint8_t transmitData
)
{
//如果未使用中断,则轮询标志
if (!(HWREG16 (baseAddress + OFS_UCAxIE)& UCTXIE)){
//轮询发送中断标志
while (!(HWREG16 (baseAddress + OFS_UCAxIFG)& UCTXIFG));<--- 如果标志 UCTXIFG 从未被置位、那么代码就在紧密循环中

HWREG16 (baseAddress + OFS_UCAxTXBUF)= transmitData;
} 

在一些其他驱动程序中(例如 I2C)  

超时计数用于避免这种情况。  

每次尝试更改标志后、超时计数器递减到0后、退出循环。  

这里我的问题是:  

在这种情况下不使用该机制是否有任何特殊原因。  

此驱动程序中有多个其他位置显示了相同的情况。  

非常感谢 您的帮助

 

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    对于 I2C 驱动程序示例、您是否参考 了 eusci_b_i2c_ex3_masterTxMultiple.c? 如果不是、您能指向相关示例吗?

    Srinas