Hi guys, i'm trying to set up a small code to echo a char in hyperterminal but it doesnt seem to work... here is my code I hope you can help me
#include <LPC214X.H> #define CR 0x0D void Initialize(void); // Inicializacion de UART0 int putchar (int ch); // Escribe un carácter en la puerta serial int getchar (void); // Lee un caracter en la puerta serial
/************************* MAIN *************************/ int main(void) { Initialize();// Inicialización de la UART0 while(1) { putchar(U0RBR);
};
}
int putchar (int ch) /* Write character to Serial Port */ { if (ch == '\n') { while (!(U0LSR & 0x20)); U0THR = CR; /* output CR */ } while (!(U0LSR & 0x20)); return (U0THR = ch); } int getchar (void) /* Read character from Serial Port */ { while (!(U0LSR & 0x01)); return (U0RBR); } /*************** System Initialization ***************/ void Initialize() { VPBDIV =0x00; /* Initialize Pin Select Block for Tx and Rx */ PINSEL0=0x5; /* Enable FIFO's and reset them */ U0FCR=0x7; /* Set DLAB and word length set to 8bits */ U0LCR=0x83; /* Baud rate set to 9600 */ U0DLL=0x62; U0DLM=0x0; /* Clear DLAB */ U0LCR=0x3; } /*********************************************************/