How to display text on 16×2 LCD using AVR microcontroller (ATmega16)

This article is in continuation to the article Single character LCD display using AVR. The aforesaid article shows how to display a single letter on LCD. Moving forward towards learning to work with LCD, this article explains how to display a string on LCD. Displaying string is occasionally used in many applications.
How to display text on 16x2 LCD using AVR microcontroller (ATmega16)
The connection of the LCD with the AVR microcontroller (ATmega16) is shown in the circuit diagram. A string is nothing but a sequence of characters. The following steps explain how to display a string on the LCD.
To send string on LCD:
        i.            Make a string pointer variable
       ii.            Pass the starting address of string to that pointer variable
      iii.            Pass the string pointer value to the LCD_write function
      iv.            Increment the pointer value and go to step (iii.) till the value of pointer reaches NULL character.
How to display text on 16x2 LCD using AVR microcontroller (ATmega16) schematic
void LCD_write_string(unsigned char *str) //store address value of the string in pointer *str
{
int i=0;
while(str[i]!=’\0′) // loop will go on till the NULL character in the string
{
LCD_write(str[i]); // sending data on LCD byte by byte
i++;
  }
return;
}

For more detail: How to display text on 16×2 LCD using AVR microcontroller (ATmega16)


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top