当我用 COM 线连接两个 Board-DE2 时,此代码不会通过 UART 发送数据。我不明白为什么它不运行。怎么了?
#define RS232_UART_DATA ((volatile int*) 0x10001010)
#define RS232_UART_CONTROL ((volatile int*) (0x10001010+4))
int main()
{
unsigned char hwld[] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
unsigned char *pOutput;
pOutput = hwld;
while(*pOutput) //strings in C are zero terminated
{
//if room in output buffer
if((*RS232_UART_CONTROL)&0xffff0000 )
{
//then write the next character
*RS232_UART_DATA = (*pOutput++);
}
}
}