typedef unsigned char u8;
我看USART_SendData的函数体中,第二个参数明明是u16的类型啊,即使后面有USARTx->DR = (Data & (u16)0x01FF);也是取Data的低9位啊,这个强制转换为u8是为什么啊!!!?
/*******************************************************************************
* Function Name : USART_SendData
* Description : Transmits single data through the USARTx peripheral.
* Input : - USARTx: Select the USART or the UART peripheral.
* This parameter can be one of the following values:
* - USART1, USART2, USART3, UART4 or UART5.
* - Data: the data to transmit.
* Output : None
* Return : None
*******************************************************************************/
void USART_SendData(USART_TypeDef* USARTx, u16 Data)
{
/* Check the parameters */
assert_param(IS_USART_ALL_PERIPH(USARTx));
assert_param(IS_USART_DATA(Data));
/* Transmit Data */
USARTx->DR = (Data & (u16)0x01FF);
}