00001 00023 #include <includes.h> 00024 00025 //******************************************************************************* 00026 // sendchar/getkey function using UART0 00027 //******************************************************************************* 00028 /* This is necessary for printf function. 00029 Make sure to include the right version of Retarget.c in the project workspace.*/ 00030 00031 #define CR 0x0D 00032 00033 int sendchar (int ch){ 00034 if (ch == '\n') { 00035 while (!(U0LSR & 0x20)){}; 00036 U0THR = CR; /* output CR */ 00037 } 00038 while (!(U0LSR & 0x20)){}; 00039 return (U0THR = ch); 00040 } 00042 int getkey (void){ 00043 while (!(U0LSR & 0x01)){}; 00044 return (U0RBR); 00045 } 00046