LCD interfacing

09- AVR ATmega 16 Tutorials- Interfacing an LCD || Part I || Working with LCD Library Leave a comment

Hello everyone and welcome back to the Blog.

In this post, we are going to start working with Liquid Crystal Displays more commonly known as LCDs. LCD is a flat panel display technology commonly used in TVs and computer monitors. It is also used in screens for mobile devices, such as laptops, tablets, and smartphones. In fact, our modern world today is filled with LCD screens; from home appliances such as washing machines and microwave ovens to cockpit panels in aeroplanes and display screens in cars. They are everywhere displaying the vast array of data we need in our day to day lives.

TFT Screen

An LCD is made with either a passive matrix or an active matrix display grid. Each LCD screen contains a matrix of pixels that display the image on the screen. The active matrix LCD is also known as a thin film transistor (TFT) display. The passive matrix LCD has a grid of conductors with pixels located at each intersection in the grid. A current is sent across two conductors on the grid to control the light for any pixel. An active matrix has a transistor located at each pixel intersection, requiring less current to control the luminance of a pixel. For this reason, the current in an active matrix display can be switched on and off more frequently, improving the screen refresh time (your mouse will appear to move more smoothly across the screen, for example).

16*2 Alphanumeric LCD

For our purposes, we are going to use a 16*2 Alphanumeric LCD. It has two rows with sixteen columns each and as a result, it can display sixteen characters or numbers at once on each row(hence the name 16*2). It is called Alphanumeric because it can only display numbers, alphabets and some special characters. It cannot display images; as for that, we need to use a Graphical LCD or GLCD in short.

In this post, I am going to explain about the various Pins present in the LCD and how to interface them with an ATmega16 microcontroller. I will also show how to use the Library code for displaying numbers and characters on the display. But we will not get into details of working of the code. That we will leave for Part II of this post.

LCD Pin Description

Pin Description:

As you can see in the picture to the left, most 16*2 Alphanumeric LCD has 16 Pins in it. Some might not have the last two pins which correspond to the backlight LED, but in my experience most of them do.

  • The first pin VSS is actually the Ground pin.
  • The second pin VDD is the Power pin to which a positive voltage of 5Volts needs to be given.
  • The third pin VEE is used for contrast setting. A 10K Potentiometer(variable resistor) as shown in the picture to the right needs to be connected with it. By turning the coil of the potentiometer the contrast of the LCD can be set. (Note: For more details refer to the circuit diagram and video below)

    Potentiometer
  • Next up are three control pins RS, RW and E. They are used to control all the operations of the LCD. They are to be directly connected to the microcontroller. Here RS stands for Resistor Select pin, RW stands for Read/Write pin and E stand for Enable pin. I will talk about them in more details in the next Post.
  • Then we have eight data line pins from D0 to D7. The data that needs to be displayed on the LCD is passed through this eight-bit data bus. These eight pins are also to be directly connected to the microcontroller.
  • Finally, we have two more pins which correspond to the backlight LED in the LCD. The VDD is the Positive pin while VSS is the Ground pin.

The circuit diagram for connecting the LCD with the microcontroller has been given below:

Circuit Diagram:

I would now ask you to go through the video below where I explain everything I have been talking about including the code in details.

Video:

 

Download the Makefile needed for compilation and copy it into the folder where you have saved the source file.

Code:

Shop Smart with us for Best Prices:

If you want to continue on with this series I would ask you to visit our YouTube channel and subscribe to receive continuous notifications. You can also subscribe to our Newsletter below to get email notification of each post as and when they are posted.

You can also follow us on social media platforms such as  Facebook and Twitter.

Thanks a lot for reading through this post. Feel free to follow through this series and comment your queries in the comment box below. Also feel free to contact us regarding any out of stock product and we will try to get back to you as soon as possible.

Leave a Reply