In this tutorial you know about What is lcd and how to add library on avr studio 

I divided this tutorial into two part
part 1- Knowing about LCD
part 2- Add lcd library on avr studio 

Part-1:
 Liquid Crystal Display is know as LCD is an electronic display which is commonly used many applications such as calculators, laptops, tablets, mobile phones etc. there are many type  of LCD
such as 16×2 character LCD module is a very basic module which is commonly used by electronic hobbyists and is used in many electronic devices and project. It can display 2 lines of 16 character and each character is displayed using 5×7 or 5×10 pixel matrix


16×2 LCD can be interfaced with a microcontroller in 8 Bit or 4 Bit mode. These differs in how data and commands are send to LCD. In 8 Bit mode character data (as 8 bit ASCII) and LCD command are sent through the data lines D0 to D7. That is 8 bit data is send at a time and data strobe is given through E of the LCD.

But 4 Bit mode uses only 4 data lines D4 to D7. In this 8 bit data is divided into two parts and are sent sequentially through the data lines. The idea of 4 bit communication is introduced to save pins of microcontroller. 4 bit communication is bit slower than 8 bit but this speed difference has no significance as LCDs are slow speed devices. Thus 4 bit mode data transfer is most commonly used.


Part 2:
now open your avr studio flow this instruction 
first go to new project then select your programming language then select board project then select your project name and saving folder

now select your controller type here i select atmega 8

 Download  LCD library on Click here or click here 

after downloading is the time of including library on avr studio 
first you have to need included avr.io hared file   #include <avr/io.h>  

now it is the time of add library on this project so go to menu bur project option and create a new folder and give this name Lcdlbr

now add lcd header and C file in this folder to flowing image





  Coding

Now that you have gone through the different functions available, let’s write a sample code for it. Don’t forget to include “lcd.h” header file.

#include <avr/io.h>
#include "Lcdlbr/lcd.h"

int main(void)
{
lcd_init(LCD_DISP_ON_CURSOR); /*initialize lcd,display on, cursor on */

                 lcd_clrscr();             /* clear screen of lcd */
lcd_home();               /* bring cursor to 0,0 */
lcd_puts("hello");        /* type something random */
lcd_gotoxy(0,1);          /* go to 2nd row 1st col */


lcd_puts("Mechatronicslab");  /* type something random */
        while (1) 
    {
    }
}

After building the project and burning your code, you will see “hello” written in the first row and “Mechatronicslab” written in the second row. This was a basic example. Now it’s up to you upon how to exploit the library resources. Okay, try this one out by yourself.

Circuit Diagram






Possible Errors and solution 

While connecting the LCD, you might face some problems. Some of the most common problems that you might face are:
  • Nothing is visible on the screen.
  • Black Squares are visible on the screen.
  • Only the cursor blinks on the screen.
  • Sometimes even the screen blinks.
  • Random/Garbage symbols are displayed on the screen.

For such troubles, you can follow the following troubleshooting methods (most of the time it works out!).
  • Adjust the contrast pot to increase visibility.
  • Check your connections. Check for any short circuit.
  • Check and change the delay. Make sure you have entered the correct XTAL value in “lcd.h” file.
  • And last but not the least, check your code! ;)

You can complete  download Atmel Studio files and Proteus File Click Here
Proteus Software free download  with Crick  Click Here

No comments

Theme images by Dizzo. Powered by Blogger.