Problem with LPC2138 UART code

Status
Not open for further replies.

bandaru_sivakrishna

Newbie level 2
Joined
Sep 29, 2007
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,294
#include <LPC213X.H>

void delay(int);

int main()
{
unsigned long temp;
unsigned char a;

PINSEL0 = 0x5;

U0LCR = 0x83;
U0DLL = 0x61;
U0DLM = 0x00;
U0LCR = 0x03;

while(1)
{
while (!(U0LSR & 0x01)); //receive condition
a = U0RBR;
delay(10);
while (!(U0LSR & 0x20)); //transmit condition
U0THR = a;
}
}

void delay(int x)
{
unsigned int i,j;
for(i=0;i<x;i++)
for(j=0;j<113;j++);
}


this code works
 

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…