发现TI LM4F232硬件库还有软件库函数有错误
[复制链接]
这是库函数,因为这个错误让我找了好久。
//*****************************************************************************
//
//! Sends an address character from the specified port when operating in 9-bit
//! mode.
//!
//! \param ulBase is the base address of the UART port.
//! \param ucAddr is the address to be transmitted.
//!
//! This function waits until all data has been sent from the specified port
//! and then sends the given address as an address byte. It then waits until
//! the address byte has been transmitted before returning.
//!
//! The normal data functions (UARTCharPut(), UARTCharPutNonBlocking(),
//! UARTCharGet(), and UARTCharGetNonBlocking()) are used to send and receive
//! data characters in 9-bit mode.
//!
//! \note The availability of 9-bit mode varies with the Stellaris part in use.
//! Please consult the datasheet for the part you are using to determine
//! whether this support is available.
//!
//! \return None.
//
//*****************************************************************************
void
UART9BitAddrSend(unsigned long ulBase, unsigned char ucAddr)
{
unsigned long ulLCRH;
//
// Check the arguments.
//
ASSERT(UARTBaseValid(ulBase));
//
// Wait until the FIFO is empty and the UART is not busy.
//
while(HWREG(ulBase + UART_O_FR) & (UART_FR_TXFE | UART_FR_BUSY))
{
}
//
// Force the address/data bit to 1 to indicate this is an address byte.
//
ulLCRH = HWREG(ulBase + UART_O_LCRH);
HWREG(ulBase + UART_O_LCRH) = ((ulLCRH & ~UART_LCRH_EPS) | UART_LCRH_SPS |
UART_LCRH_PEN);
//
// Send the address.
//
HWREG(ulBase + UART_O_DR) = ucAddr;
//
// Wait until the address has been sent.
//
while(HWREG(ulBase + UART_O_FR) & (UART_FR_TXFE | UART_FR_BUSY))
{
}
//
// Restore the address/data setting.
//
HWREG(ulBase + UART_O_LCRH) = ulLCRH;
}
注意看两个while循环就知道错在哪里了。
实际运行用ROM_库也是错的!
|