16×1 LCD displaying only first 8 characters – Reason

 #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 8×2 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 16×1 LCD display whose display memory is organized in a 8×2 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 :

 

Leave a Comment

Your email address will not be published. Required fields are marked *