请参考以下代码
int main (void)
{
char ch;
#ifdef CMSIS // If we are conforming to CMSIS, we need to call start here
start();
#endif
printf("\n\r\n\r*** Running the hello_world project ***\n\r");
EnableInterrupts;
enable_irq(20);
UART_RIE_Enable();
while(1)
{
ch = in_char();
out_char(ch);
}
}
void UART_RIE_Enable(void)
{
UART0_C2|= UART_C2_RIE_MASK ;
}
void UART_Isr(void)
{
char rev;
if(UART0_S1 & UART_S1_RDRF_MASK)
{
rev = UART0_D;
out_char(rev);
}
}
|