You Are Here: Home » AVR ATmega Projects » LCD Projects » How to display text on 16×2 LCD using AVR microcontroller (ATmega16)

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)

Leave a Comment

You must be logged in to post a comment.

Read previous post:
Monkeys regulate metabolism to cope with environment and rigours of mating season

New research on male Barbary macaques indicates that these primates have a flexible metabolic physiology, which help them survive by...

Close
Scroll to top