16×4 LCD/20×4 LCD line addresses

What i mean is, given the same circuit which was built for a 16×2 LCD display can be used with a 16×4 LCD display with no hardware changes needed at all. Even the program/code written for the 16×2 display works fine with the 16×4 LCD display except that you will only be able to display on the first two lines only. There are separate commands for setting the cursor to the required line in these displays. These commands set the line address and place the cursor at the appropriate line. Here i have listed down the line addresses for the 16×4/20×4 LCD display, 

 

For displaying the characters on the 1st line send the command 0x80

For displaying the characters on the 2nd line send the command 0xC0

For displaying the characters on the 3rd line send the command 0x94

For displaying the characters on the 4th line send the command 0xD4

 

WriteLCDCommand( 0x80 ); // Sets cursor to line 1 of display

WriteLCDCommand( 0xC0 ); // Sets cursor to line 2 of display

WriteLCDCommand( 0x94 ); // Sets cursor to line 3 of display

WriteLCDCommand( 0xD4 ); // Sets cursor to line 4 of display

 

Also see: 

 

Leave a Comment