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> void Initialize(void); // Inicializacion de UART0 void init_PLL(void); //Inicializacion del PLL #define TEMT (1<<6) #define LINE_FEED 0xA #define CARRIAGE_RET 0xD /************************* MAIN *************************/ int main() { int i; char c[]="Philips LPC"; init_PLL(); //Inicialización del PLL Initialize(); //Inicialización de la UART0 Initialize(); /* Print forever */ while(1) { i=0; /* Keep Transmitting until Null character('\0') is reached */ while(c[i]) { U0THR=c[i]; i++; } U0THR=LINE_FEED; U0THR=CARRIAGE_RET; /* Wait till U0THR and U0TSR are both empty */ while(!(U0LSR & TEMT)){} } } /*************** 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=0xC2; U0DLM=0x0; U0LCR=0x03; } void init_PLL(void) { PLL0CFG = 0x00000024; // Set multiplier and divider of PLL to // give 60.00 MHz PLL0CON = 0x00000001; // Enable the PLL PLL0FEED = 0x000000AA; // Update PLL registers with feed sequence PLL0FEED = 0x00000055; while (!(PLL0STAT & 0x00000400)); // test Lock bit PLL0CON = 0x00000003; // Connect the PLL PLL0FEED = 0x000000AA; //Update PLL registers PLL0FEED = 0x00000055; VPBDIV = 0x00000002; //Set the VLSI peripheral bus to 30.000MHz } /*********************************************************/
"doesn't seem to work" isn't a really descriptive explanation of your problems. What doesn't work? What does work? In what way does your solution deviate from your expected results? What have you done to try to pin-point the problem?
By the way - the UART does not send one character everytime you write to the transmit register. You enable the FIFO but your code do never look if there is room for more data.
What happens when your program finally returns from main()? Do you get to a command prompt?