void UART0_Init()
{
/*---------------------------------------------------------------------------------------------------------*/
/* Init UART */
/*---------------------------------------------------------------------------------------------------------*/
UART0->BAUD = UART_BAUD_MODE2 | UART_BAUD_DIV_MODE2(__XTAL,115200);
_UART_SET_DATA_FORMAT(UART0, UART_WORD_LEN_8 | UART_PARITY_NONE | UART_STOP_BIT_1);
}
int main(void)
{
uint32_t u32Item;
SYS_Init();
UART0_Init();
printf("请发送一个字符\n");
while(1)
{
u32Item = getchar();
printf("你发送的是:%c\n",u32Item);
}
}
|