69,373
社区成员
发帖
与我相关
我的任务
分享
rGPHCON = 0xaa0;
rGPHUP = 0x03c;
rUFCON0 = 0x0;
rUMCON0 = 0x0;
rULCON0 = 0x3; //Line control register : Normal,No parity,1 stop,8 bits
rUCON0 = 0x05; // Control register
rUBRDIV0==(int)(50000000/(115200*16))-1;
rUFCON1 = 0x0;
rUMCON1 = 0x0;
rULCON1 = 0x3; //Line control register : Normal,No parity,1 stop,8 bits
rUCON1 = 0x05; // Control register
rUBRDIV1=( (int)(50000000/16./115200) -1 );
#include "2440addr.h"
#include "uart.h"
int main()
{
uartini(); //串口初始化
while(1)
{
uart1SendByte('1');
}
return 0;
}
/*******************************************************
【函数功能】 从串口1发送字符
********************************************************/
void uart1SendByte(char data2)
{
if(data2=='\n')
{
while(!(rUTRSTAT1 & 0x2));
// Delay(1); //because the slow response of hyper_terminal
rUTXH1 = '\r';
}
while(!(rUTRSTAT1 & 0x2)); //Wait until THR is empty.
// Delay(1);
rUTXH1 = data2;
}