想用9200做一个串口,可发送一直无法完成,下面为简单的代码:
void Uart1_Init(void) { //Configure PIO controllers to drive US1 signals AT91F_US1_CfgPIO (); //Enable Peripheral clock in PMC for US0 AT91F_US1_CfgPMC(); AT91F_US_Configure ( (AT91PS_USART) AT91C_BASE_US1, // US1 base address 60000000, //60 MHz AT91C_US_ASYNC_MODE ,//AT91C_US_CHMODE_NORMAL | AT91C_US_PAR_NONE , // mode Register to be programmed 115200 , // baudrate to be programmed 0); AT91F_US_EnableTx((AT91PS_USART)AT91C_BASE_US1); }
void AT91F_US1_Printk( char *buffer) // \arg pointer to a string ending by \0 { while(*buffer != '\0') { while (!AT91F_US_TxReady((AT91PS_USART)AT91C_BASE_US1)); AT91F_US_PutChar((AT91PS_USART)AT91C_BASE_US1, *buffer++); } }
int main()
{
Uart1_Init();
while(1)
{
delay_s(5);
AT91F_US1_Printk("\n\rBasicBoot Successfull: Enter main()_US1\n\r");
}
}
可一直没有数据输出,谢谢各位了!
|