#include<lpc214x.h>
void init() //initializes both UARTS @9600,8bit, no pairity,1 stopbit
{
U0LCR=0x83;
U0DLL=0x61;
U0DLM=0x00;
U0LCR=0x03;
U1LCR=0x83;
U1DLL=0x61;
U1DLM=0x00;
U1LCR=0x03;
}
void senduart0(unsigned char a) //sends a byte through UART0
{
U0THR=a;
while(U0LSR!=0x60);
}
void senduart1(unsigned char a) //sends a byte through UART0
{
U1THR=a;
while(U1LSR!=0x60);
}
unsigned char recuart1() //recieves a byte from UART1
{
unsigned char p;
while ((U1LSR&0x01)!=1);
p=U1RBR;
return p;
}
int main()
{
PINSEL0=0x00050005;
PINSEL1 = 0x00000000;
PINSEL2 = 0x00000000;
init();
senduart1('A');
senduart1('T');
senduart1(0x0D);
senduart0(recuart1());
senduart0(recuart1());
senduart0(recuart1());
senduart0(recuart1());
senduart0(recuart1());
}