This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Uart in lpc1768

hello,i want to initlize uart 0 in lpc1768 ,but i have a problem.

this is my code:

int main(void)
{
SystemCoreClockUpdate();
UART0_Init(9600);
while(1)
{
 while(!(LPC_UART0->LSR & (1<<0)));
 LPC_UART0->THR = LPC_UART0->RBR;
 while(!(LPC_UART0->LSR & (1<<5)));

}

}

void UART0_Init(uint32_t baudrate)
{
LPC_SC->PCONP |= (1<<3);
LPC_PINCON->PINSEL0 &= ~0x000000F0;
LPC_PINCON->PINSEL0 |= 0x00000050; /* RxD0 is P0.3 and TxD0 is P0.2 */

LPC_UART0->FCR = (1<<0) | (1<<1) | (1<<2); /* Enable and reset TX and RX FIFO. */
LPC_UART0->LCR = 0x83;
LPC_UART0->DLL = 0xA2;
LPC_UART0->DLM = 0;

 LPC_UART0->LCR &= ~(1<<7);

}

when i debbug this code my registers is like this:

the registers didnt set currectly.how should i do?