Albert Einstein

Albert Einstein
My inspiration....

Pages

Search Box

Custom Search

Search Result Place

LCD Control using UART Serial Port

Introduction:
When you write an LCD Program to write your name or any text, you can only display the same text at all times. If you have to change the text, you have to change the code, recompile it again and then reprogram it. Instead of doing all this, you can just connect your circuit to serial port of computer and change the text on LCD instantly using the hyperterminal of the PC. You can just type any text in the hyperterminal and press ENTER key. The text will be displayed on the LCD instantly. You can customize the display by changing the pattern.





AVR GCC CODE
/*
Purpose:It will take input from the terminal and writes that on LCD
Hardware: 
ATmega8 @ 16MHz 
PC Software : Hyper terminal @ 19200 baud 
No Parity,1 Stop Bit, 
Flow Control = NONE 
*/ 
#include  
#include  
#include   
#include 
#include "uart.h" 
#include "lcd.h" 
 
static int uart_putchar(char c, FILE *stream);
static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE);
 
static int uart_putchar(char c, FILE *stream)
{
if (c == '\n')
uart_putchar('\r', stream);
loop_until_bit_is_set(UCSRA, UDRE);
UDR = c;
return 0;
}
 
int main()
{
stdout = &mystdout;
   //Initialize the LCD Module. 
   LCDInit(LS_BLINK|LS_ULINE);
   LCDClear();
   //USART Initialisation 19200bps @ 16MHz crystal 
   USARTInit(51);
char str[20],data; int i=0; while(1) { printf("\n PLEASE ENTER THE STRING : "); for(i=0;;i++) { data = USARTReadChar();
//saving the given string
   USARTWriteChar(data);
   str[i]= data;
   if((str[i]=='\n') ||( str[i]=='\r'))
   {
   str[i]='\0';
   break;
   }
   }
LCDClear();
LCDWriteString(str);
//displaying the saved string
printf("\n Finished \n"); _delay_ms(1000); } }

Implementation:
Open the hyperterminal in your computer. Set the settings as per the code. Then reset your microcontroller. You will see "enter the string : ". Enter the text and press ENTER key. You will get "Finished". You will see the text you entered on the display.


Downloads:
Files related to this project. Click here to download

NEXT VERSION:
The text will display only when you enter the text from terminal. I am developing this code for new options. In the later version of this project, the entered text is saved in the EEPROM and if you change the code directly from the terminal.
I will be updating this post regularly, so subscribe to my blog newsletter(top right of this page) for updated information. If you have any doubts, post you comments here or mail me @ arifuddin2007@gmail.com Arifuddin Sheik

6 comments:

sorna said...

Thanks for sharing, I will bookmark and be back again

BE ECE Projects

manohar said...

PC Richard and Son said...

I am happy that all the gadgets are now a days coming with electronic circuits which means we can control all our gadgets with one master remote
PC Richard

Ravi said...

Great Work!


www.nrdcentre.com

Databi Solutions said...

good one..

http://databi.co/

IEEE Projects in Chennai, ASK2Projects said...

ASK2projects provides best final year IEEE projects for Engineering/Diploma students particularly for EEE, E&I, ECE department students. We are the best IEEE Projects Center in Chennai.IEEE Projects in Chennai, IEEE Projects Center in Chennai, Best Project Centers in Chennai for Electrical and Electronics Engineering

No of times page visited

CONNECT WITH FACEBOOK

Newsletter

Followers

Recent Posts

Blogger WidgetsRecent Posts Widget for Blogger

About Me

My photo
Visakhapatnam, Andhra Pradesh, India
I am graduate from Swarna Bharathi College of Engineering in Khammam, Andhra Pradesh, India. Currently I am doing a business. After seeing the response to my blog, I am planning to start my old electronics geek work again. Now I have got more funds and I am planning to do some creative projects. Thanks for all those who encouraged me for doing this wonderful job.