请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:TMS320F280025 主题中讨论的其他器件:C2000WARE
尊敬的香榭丽舍
我向我们的客户提出这一问题。
如果他们需要确认 TX 缓冲区已空、然后在半双工 RS485收发器上启用 RX。
如果用户使用 SCI 模块、该怎么办?
黄维恩
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.
尊敬的香榭丽舍
我向我们的客户提出这一问题。
如果他们需要确认 TX 缓冲区已空、然后在半双工 RS485收发器上启用 RX。
如果用户使用 SCI 模块、该怎么办?
黄维恩
您好、Wayne、
感谢您的提问! 在 C2000Ware driverlib 中检查 TX 缓冲区状态的直接方法是使用"SCI_getTxFIFOStatus()"。 请参阅以下代码片段、它们的作用与之相反(等待至少一个字节可用、这意味着几乎已满):
// // Wait until space is available in the transmit FIFO. // while(SCI_getTxFIFOStatus(base) == SCI_FIFO_TX15) { }
您可以改为使用>= SCI_FIFO_TX0来有效地等待"而 FIFO 不为空"。
此致、
Vince
尊敬的 Vince:
如果 FIFO 未被使用、那么是否有任何寄存器/位/中断可用于检查 SCI 模块上的空位?
韦恩
您好、Wayne、
请参阅以下函数、该函数检查发送缓冲区是否有来自 C2000Ware 的非 FIFO 空间。 您还可以在 C2000Ware 中的"sci.h"和"sci.c"文件中找到这些函数等、这些文件提供了 SCI 软件上的其他可用函数/功能!
//***************************************************************************** // //! Determines if there is any space in the transmit buffer when the FIFO //! enhancement is not enabled. //! //! \param base is the base address of the SCI port. //! //! This function returns a flag indicating whether or not there is space //! available in the transmit buffer when not using the FIFO enhancement. //! //! \return Returns \b true if there is space available in the transmit buffer //! or \b false if there is no space available in the transmit buffer. // //***************************************************************************** static inline bool SCI_isSpaceAvailableNonFIFO(uint32_t base) { // // Check the arguments. // ASSERT(SCI_isBaseValid(base)); // // Return the availability of space. // return(((HWREGH(base + SCI_O_CTL2) & SCI_CTL2_TXRDY) == SCI_CTL2_TXRDY) ? true : false); }
此致、
Vince