各位大哥,小弟找到了下面一段程序,烧到arm板后,输出的字符完全不正确,请问是什么原因?
void Uart_Init(int mclk,int baud) { int i; if(mclk==0) mclk=MCLK; rUFCON0=0x0; file://FIFO disable rUFCON1=0x0; rUMCON0=0x0; rUMCON1=0x0; file://UART0 rULCON0=0x3; file://Normal,No parity,1 stop,8 bit // rULCON0=0x7; file://Normal,No parity,2 stop,8 bit rUCON0=0x245; file://rx=edge,tx=level,disable timeout int.,enable rx error int.,normal,interrupt or polling rUBRDIV0=( (int)(mclk/16./baud + 0.5) -1 ); file://rUBRDIV1=(int)(mclk/(baud*16))-1;//jack file://UART1 // rULCON1=0x7; file://Normal,No parity,2 stop,8 bit file://rULCON1=0x3; file://rUCON1=0x205;//0x245 // rUBRDIV1=( (int)(mclk/16./baud + 0.5) -1 ); file://rUBRDIV1=(int)(mclk/(baud*16))-1;//jack
for(i=0;i<100;i++); }
void Uart_SendByte(int data) { while(!(rUTRSTAT0 & 0x2)); file://Wait until THR is empty. file://Delay(10); WrUTXH0(data);
}
void Main(void) { rSYSCFG = 0x08; file://8K字节cache,写缓冲使能,data abort使能 file://Port_Init(); file://IO口初始化 Uart_Select( 0 ) ; file://选择串口0 Uart_Init( 0, 9600 ) ; Uart_SendByte((int)0x55);//df for(;;); } 但是在串口里看到却是3c 3c 3f,请问是什么原因呢?谢谢