Getting Started

This is 1-2. The guide is the most up-to-date and is a huge guide prepared by collecting and researching almost all the sources, especially about the 16x2 LCD and the history of LCD. With the information you will learn, you will be able to understand how the LCD you will see in one place works, and you will be able to do it. Let’s get started right away. 🙂

What is LCD?

LCD, Liquid Crystal Display, is an imaging technology based on the principle that the electrically polarized liquid passes the light in a single phase and can be seen with a polarization filter added to the front.

The liquid crystals found in LCDs can be found in thermographic and lyotropic phases according to temperature and substance structure. Nematic liquid crystals, a subgroup of thermographic phase liquid crystals, called twisted nematic (TN), become nematic that are not curved to a flat position depending on the voltage of the applied current. Nematic liquid crystals are the liquid crystal phase that makes it possible to make LCDs. In order for LCDs to be made, light must be polarized, liquid crystals must be able to pass polarized light, the molecular arrangement of liquid crystals must be replaced by electric current, and a structure that conducts electricity must be obtained.

LCD Structure and Working Principle

Yes, let’s start by giving you some information about the structure and working principle of LCD.

Did you know that?

LCD stands for Liquid Crystal Display (Liquid Crystal Display). Basically, it is an imaging unit that uses liquid crystals to create an image.

When the current is given to this particular type of crystal, it becomes opaque, blocking the backlight behind the screen.

Thanks to this, thanks to this, the pixel areas will become darker than the others. You can understand more clearly by examining the photo below.

Eğer fotoğrafı göremiyorsanız, lütfen yorumlardan bildirebilirsiniz!
LCD Working Structure, Robotik Sistem

The display has an LED backlight and can display 32 ASCII characters on two lines, 16 characters per line. The structure of LCDs consists of different layers, as seen in the picture above.

When the LCD layers come together, the panels are formed. The working logic of the panels in their simplest form is that the specialized cells on the ion layer shape them and the image is created with electric current.

Before any electric field is applied, the liquid crystals are arranged in so-called curved nematics (TN), which are curved 90 degrees. This causes the polarization of light passing through the crystals to change direction and the screen appears gray. When a sufficiently high voltage is applied, the liquid crystals are arranged untwisted and the polarization direction of the light does not change as it passes through the liquid crystal layer. In this case, the light is polarized perpendicular to the second filter and the pixel appears black because it cannot pass through the layer.

The 16x2 LCD Screen: A Quick Overview

The screen we are going to use is a 16×2 LCD screen, which you can get at an affordable price. The fact that the screen is called 16×2 means that the LCD has 2 lines and can display 16 characters per line. So the screen can display 32 characters at the same time. You can also scroll to view more than 32 characters.

How does 16x2 LCD Screen Work?

  1. It works with +5V.
  2. It has a Back Lighting feature.
  3. It draws a 4mA current without LCD backlight.
  4. Its dimensions are 80x36x9.4mm.
  5. The operating temperature is from -20 to +70 degrees.

LCD Pins

Presently LCD panels produced today have 16 pins in a single row. The first 14 of these pins are used for control and it used the last two for the backlight, if any. The 14 pins used for control on some LCDs can also be found in 2 rows of 7.

Did you know that?

The vast majority of LCDs have a built-in series resistor for LED backlight. If you have an LCD that does not contain resistance, you need to add one between 5V and pin 15.

To calculate the value of the series resistance, you can look at the maximum backlight current and typical backlight voltage drop from the datasheet and calculate the resistance value using the simple ohm law.

(Data Sheet) If you can’t find the datasheet, it’s safe to use a 220-ohm resistor, but such a high value can darken the backlight a bit.

PIN NOFUNCTIONNAME
1Grounding (0v)Ground
2Supply voltage(+5v)VCC
3Potentiometer Introduction
(To Adjust the LCD Configuration)
VO
4Command Register Data Register
to switch between ⭐
RRegister Select
5Read/Write to LCD
operations used for ⭐⭐
Read/Write
6The process of writing to the Register enabling pinEnable
78 Bit Data Pins ⭐⭐⭐DB0
88 Bit Data Pins ⭐⭐⭐DB1
98 Bit Data Pins ⭐⭐⭐DB2
108 Bit Data Pins ⭐⭐⭐DB3
118 Bit Data Pins ⭐⭐⭐DB4
128 Bit Data Pins ⭐⭐⭐DB5
138 Bit Data Pins ⭐⭐⭐DB6
148 Bit Data Pins ⭐⭐⭐DB7
15Voltage Adjustment of BacklightLed +
16Voltage Adjustment of BacklightLed -

If you don't see the image, please let know in the comments!

LCD Pin Descriptions:

RS Pin is LOW (0), it selects Command Register, and when RS Pin is HIGH (1), it selects Data Register.

Command Recording: Command recording records the command instructions given to the LCD. A command is an instruction to the LCD to perform a predefined task.

For example:

  • Starting the screen,
  • Cleaning the screen,
  • Setting the cursor position, etc.

Processing of commands occurs in the command recording.

When we return LOW (0) to the ⭐⭐ R/W Pin, the write operation performs a read operation when we send a HIGH (1).

⭐⭐⭐ These Pins send data or commands to the LCD.

Data Record: A data record stores the data to be displayed on the LCD. The data is the ASCII value of the character to be displayed on the LCD. When we send data to the LCD, the data goes to the record and is processed there. When RS = 1, data logging is selected.

Let’s take look at what all the pins do, so we can understand better.

GND: It must be connected to any GND pins of the Arduino. This pin (minus) is the pin where the grounding connection will be made.

VCC: We must connect it to a 5 volt pin on the Arduino. The LCD will get its electricity from here.

VO (LCD Contrast): We must connect it to any GND pins in the Arduino. This pin (minus) is the pin where the grounding connection will be made.

Pin RS (Register Select): allows the Arduino to tell the LCD whether it is sending commands or data. Basically, this pin is used to separate commands from data. R/W (Read/Write): To check if you can read data from the LCD or write data to the LCD.

E (Enable): Used to activate the screen. That is, when this pin is set to LOW, the LCD cares about what happens on the R/W, RS, and bus lines; when this pin is set to HIGH, the LCD processes incoming data.

D0-D7 (Data Bus): are the pins that carry the 8-bit data we send to the screen. For example, if we want to see the character ‘A’ on the screen, we can display these pins by typing 0100 0001 (according to the ASCII table) on the LCD, but let’s continue with this topic yet. 😄

A-K (Anode & Cathode): are used to control the LCD’s backlight.

LCD Commands:

Serial No.Hex CodeLCD Screen Equivalent
101Clear Screen
202Back to Top of Line
304Move Cursor to Left
406Move Cursor to Right
505Screen Scroll Right
607Screen Scroll Left
708Screen off, cursor off
80AScreen on, cursor on
90CDisplay on, cursor off
100EThe screen is on, the cursor is flashing
110FThe screen is on, the cursor is flashing
1210Move cursor position left
1314Move cursor position right
1418Swipe all screen left
151CScroll all screen to the right
1680Force cursor to head (line 1)
17C0Force cursor to head (2nd row)
18382 rows and 5×7 matrices

Pixels:

If you look closely at the photo below, you can see a pixel on the screen, namely its small rectangles and the pixel that makes up a character.

Each of these rectangles is a grid of 5×8 pixels, in which we see a pixel in the photo. Although they only display text, they come in a number of sizes and colors: for example, 16x1, 16x4, 20x4 white text appears on a blue background, and black text appears on a green screen. The LCD screen is 16x2 in size and can show 16x2=32 characters.

It expressed each character in 8x5=40 pixels, consisting of 5 columns and 8 lines.

If you don't see the image, please let know in the comments!

Now we know that each character (5x8 = 40) has 40 pixels, and for 32 characters (32x40) we will have 1280 pixels.

In addition, it is necessary to inform the LCD about the location of the pixels. If we try to do it through the microcontroller we use in such works, we will tire the microcontroller we have. We perform such tasks with the LCD’s HD44780 interface to perform the task of receiving commands and data from the microcontroller and displaying it on the LCD screen.

So what is this HD44780?

The Hitachi HD44780 LCD controller, originally called the Hitachi HD44780, is an alphanumeric (i.e., an adjective used to describe a sequence of characters using letters and Arabic numerals in the Latin alphabet) dot-matrix liquid crystal display control developed by Hitachi in the 1980s. It is mounted on the back of the LCD.

The function of this IC (i.e. integrated circuit) is to receive commands and data from the MCU (i.e. the microcontroller unit) and process them in such a way as to display meaningful information on our LCD screen.

Many LCDs use the HD44780 interface. You can learn all the information about the Hitachi HD44780 to program the LCD screens. Click here to find this information.

Now let’s turn the back of our 16×2 LCD screen and see what’s going on here.

What Is the Task of Black Circles Behind the LCD Screen?

If you can't see the photo, please report it in the comments!
LCD black circles, Circuit Digest

These black circles behind our LCD screen act as a bridge between our microcontroller and the LCD. It consists of an interface IC and its related components to help us use the LCD with the MCU.

Displaying Special Characters on a 16x2 LCD

Creating special characters on an LCD is not so difficult. It requires knowledge of the LCD’s specially created random access memory (CG-RAM) and the LCD chip controller. Most LCDs have a Hitachi HD4478 controller.

The CG-RAM address starts at 0x40 (hexadecimal) or 64 in decimal. We can generate special characters in these addresses. Once we have created our characters at these addresses, we can simply print them by sending commands to the LCD. The following are the character addresses and printing commands.

CG-RAM CharactersCG-RAM Address (Hexadecimal)Generated Characters
Display Commands
1ˢᵗ0x400
1ˢᵗ0x481
1ˢᵗ0x562
1ˢᵗ0x643
1ˢᵗ0x724
1ˢᵗ0x805
1ˢᵗ0x886
1ˢᵗ0x967

In the table above, you can see the starting addresses for each character, along with the print commands.

The first character is created at addresses 0x40 to 0x47 and printed on the LCD by sending only the 0 command.

The second character is created in addresses 0x48 to 0x55 and is printed by sending a command 1.

How to Create Special Characters in CG-RAM?

Can create your own special characters (glyphs) and symbols for your LCD. They are extremely useful when you want to display a character that is not part of the standard ASCII character set.

CGROM and CGRAM

All LCDs based on the Hitachi HD44780 controller have two types of memory that store defined characters called CGROM and CGRAM (Character Generator ROM and RAM). While CGROM memory is non-volatile and cannot be modified; CGRAM memory is variable and can be changed at any time.

CGROM is used to store all persistent fonts that can be displayed using ASCII codes. For example, if we type 0x41, the character ‘A’ comes to the screen.

CG-RAM is the main component of creating special characters. Stores the special characters specified in the code. CG-RAM is 64 bytes in size and gives you the option to create eight characters at a time. The size of each character is eight bytes.

The CG-RAM address starts at 0x40 (hexadecimal) or 64 in decimal. We can generate special characters in these addresses. When we create our characters at these addresses, we can simply print them by sending commands to the LCD. The character addresses and printing commands are as in the table above.

On LCD screens, each character is a 5×8 matrix. Where 5 is the number of columns and 8 is the number of rows.

If you don't see the image, please let know in the comments!

Let’s make a simple example of how to create the letter ‘B’.

To form the letter ‘B’: char b [7] = {0x10, 0x10, 0x16, 0x19, 0x11, 0x11, 0x1E}; That is

We send the address where you want to create a character. So how can we make a special character for ourselves? By clicking on this link, you can make your own special characters, symbols, etc. Your imagination is limitless. Can also make any language characters you want in symbols or letters that we can do.

So what is the logic of this?

Now we create your character at this address, it sends the individual string values ‘B’ defined above to the data register of the LCD, to print the generated character in 0x40, it sends the 0 commands to the LCD’s command register. You may be 😄 a little confused, but that’s okay. The table below will explain this more clearly.

The LCD screen standard character list does not contain specific letters (ğ, İ, ö, ü, ç, ş).

If you can't see the photo, please report it in the comments!
Table for CGRAM (Edited.), Electronicsforu

Of course, we will not write using hex codes, it will be easier for us to use it with microcontrollers such as Arduino, etc. using binary codes.

International characters have specific ASCII codes. For example, we use the character ‘A’, but the microcontroller takes the character data ‘A’ and converts it to the number 61 and compares it by looking at the character set, then we see the letter ‘A’ on our screen.

Since ASCII characters are standard, they work in the following order: When we type the character ‘A’, the microcontroller converts the character ‘A’ to the number 61 consisting of 1 and 0’s, that is, it sends these ‘01100001’ bits to the LCD. Now I hope you understand why we shouldn’t write using bits… 😄 The LCD takes this binary code and converts it into data 61, then looks at the LCD character set, which is the equivalent of 61. This is the ‘A’ character. This is how events proceed in the ASCII standard, you can see the LCD’s character set below.

If you can't see the photo, please report it in the comments!
LCD Control Lines, 320volt

The characters we create start from the top left (where it says CGRAM(1)) and settle down to 8 lines. If you look at the character ‘A’ in the table, we see that it has an address of “01100001”, that is, 61. Now that we know the 16x2 LCD and understand how it works, in the second post we will try to understand coding and how it works virtually. Stay safe… 🤗