Tuesday, 20 March 2018

UART-LPC2148

#include<lpc21xx.h>
void int_uart0()
{
 U0FCR=0x07;
 U0LCR=0x83;
 U0DLL=98;
 U0LCR=0x03;

}
void uart0_send(unsigned char data)
{
 U0THR=data;
 while((U0LSR&0x40)==0);
}
void uart0_receive()
{
 while(!(U0LSR&0x01));
 uart0_send(U0RBR);
}
void uart_msg(unsigned char *msg)
{
 while(*msg)
 {
  uart0_send(*msg);
  msg++;
 }
}    
main()
{
PINSEL0=0x00000005;
int_uart0();
uart_msg("WELCOME TO VIIT PUNE");
while(1)
{
 uart0_receive();
}
}

No comments:

Post a Comment

PIC Course with IIT Bombay

 Embedded Lab Course with PIC18F4550 by IIT Bombay 2017-18 Overview: Below course was conducted as an outreach initiative of Wadhwani Elect...