# 16x1 LCD displaying only first 8 characters - Reason

You may have come across this problem when your 16x1 LCD is displaying only the first 8 characters (Half line). Let me explain why is it happening so. There are two types of 16x1 LCD display's available in market, the difference between them being the addressing logic used by each type.

#1. In the first type, the display memory is organized in a 16X1 configuration.

#2. In the second type, the display memory is organized in 8x2 configuration.

The first type of display is not of our concern as all the 16 characters in the line are easily accessed by setting the line address to 0x80.

The subject of the discussion is the second type 16x1 LCD display whose display memory is organized in a 8x2 configuration. In this type of displays, the first 8 characters of the line start with the address 0x80 and the last 8 characters start at the address 0x80+0x40=0xC0. So, while using this type of display we need to address the first 8 characters(left half) as first line and the last 8 characters(right half) as second line.

To demonstrate, say suppose if you want to display "123456789ABCDEF" on the first type of LCD display, the code normally would look like,

{code}

```WriteLCDCommand(0x80); // Set the cursor to the start of the line.
WriteLCDData('1');
WriteLCDData('2');
WriteLCDData('3');
WriteLCDData('4');
WriteLCDData('5');
WriteLCDData('6');
WriteLCDData('7');
WriteLCDData('8');
WriteLCDData('9');
WriteLCDData('A');
WriteLCDData('B');
WriteLCDData('C');
WriteLCDData('D');
WriteLCDData('E');
WriteLCDData('F');

```

{/code}

Now if you use the same code for the second type display, only the string "12345678" will be displayed and the right half of the string is lost as shown in the image below. This is because this type of display treats the first 8 characters (left half) as first line(Address 0x80) and the last 8 characters (right half) as second line(Address 0xC0).

If you want to display the text on the right half of the display then you have to address the 9th character as a different line. Means you have to set the cursor position to second lines first character (Address 0xC0) or the 9th character. The code would look like,

{code}

```WriteLCDCommand(0x80); // Set the cursor to the start of the line or 1st character.
WriteLCDData('1');
WriteLCDData('2');
WriteLCDData('3');
WriteLCDData('4');
WriteLCDData('5');
WriteLCDData('6');
WriteLCDData('7');
WriteLCDData('8');
WriteLCDCommand(0xC0); // Set the cursor to the second line or 9th character.
WriteLCDData('9');
WriteLCDData('A');
WriteLCDData('B');
WriteLCDData('C');
WriteLCDData('D');
WriteLCDData('E');
WriteLCDData('F');

```

{/code}

Also see :

is the author of this blog and is an Embedded systems design engineer by profession & Founder @ Valetron Systems Pvt Ltd

Email:This email address is being protected from spambots. You need JavaScript enabled to view it.

HIRE ME FOR YOUR PROJECT AS A FREELANCER

#### EasyEDA: Free Circuit Design Software

• Easy Schematic Capture
• Powerful Circuit Simulation
• Online PCB design

Design Your Circuit and PCB here:

https://easyeda.com/editor

Cheap PCB Manufacturing

Electronic Components Online Store