[ARM] Initialize the UART in lpc2138

Status
Not open for further replies.

soft_learn

Newbie level 5
Joined
May 22, 2014
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
69
Hi,

I am newbie learner to ARM7 processor LPC2138 n in which i am trying to interface UART to send a single character but it sends out unwanted character. If any one here knows about the UART of lpc2138 plz help me out.
My code is :

Code:
#include <LPC213x.h>
void UART0_Init(void)
{
    PINSEL0 = 0x00000005;                //P0.0 as TX0 and P0.1 as RX0
    U0LCR = 0x00000083;                                    // Enable Access to Divisor Latch
    U0DLM = 0x00;
    U0DLL = 0x00000062;                                    //Baud Rate of 9600
    U0LCR = 0x00000003;                                    //Disable Access to Divisor Latches
}

void UART0_Write(unsigned char c)
{ 
    while(!(U0LSR & 0x20));                        
    U0THR = c;
}


int main()
{
	UART0_Init();
	
		UART0_Write('A');
	
}
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…