#include "UART.h"
#include "def21469.h"
#include "Cdef21469.h"

void Write_UART(int data)
{

	while((*pUART0LSR&UARTTHRE)==0);
			*pUART0THR=data;
			
}



int Read_UART()
{
	int temp;
	
	while((*pUART0LSR&UARTDR)==0);
			temp=*pUART0RBR;
			
	return temp;
}

void Init_UART()
{
	
		*pUART0TXCTL=0;
		
		*pUART0RXCTL=0;
		
		//Baud Rate Divisor = 331776/(32*115.2)=0x5A for 115200 Baud rate
		
		*pUART0LCR=UARTDLAB;
	
		*pUART0DLL=DLL;
		
		*pUART0DLH=DLH;
		
		
		*pUART0LCR=UARTWLS8;
		
		*pUART0TXCTL=UARTEN;
		
		*pUART0RXCTL=UARTEN;
		
		
}
