I'm planning on using a 44780 20x4 LCD display in my project. I've laid out all the messages that will need to be display and the 20x4 will work really nicely. I controlling the display with a PIC from Microchip in 4-bit mode. I've only worked with 16x2 displays in the past and I'm having some trouble understanding the 20x4 since all the books I have, example codes I've found online, all use the 16x2. So I have two questions:
The command for setting the interface (8-bit/4-bit), display lines, and character font is 001DNF** where:
D - Interface length; 1=8-bit 0=4-bit
N - Number of display lines; 1=2 0=1
F - Character font; 1=5x10 0=5x7
So if I have a 20x4 display, how do I indicate 4 lines instead of just one or two? Do I just set it to 2 lines?
The second question I have is that according to the book I have on 44780-devices the start address of each line is:
1st line - 00H
2nd line - 40H
3rd line - 20H
4th line - 40H
This doesn't make sense that the 2nd and 4th line start at the same address. I got this from the book "Programming and Customizing the PIC Microcontroller 3rd Edition". However on a website I found they list it as this:
1st line - 00H
2nd line - 40H
3rd line - 14H
4th line - 54H
I found this at http://www.8052.com/tutlcd2.php. This seems to make more sense because, as I understand it, the 3rd line is a continuation of the 1st line and if a string more then 16 characters is written to the 1st line, it will automatically wrap to the 3rd. This also the reason why, I assume, you need to select 2 lines when initializing the LCD module?
Are my assumptions with this device correct? If I got something wrong I look forward to hearing the correct way to do this (especially the starting address of each line since I will be writing different data to each line so it is important for me to know this). I wish the datasheet was a little more clear on this.
The datasheet I found for the 44780 doesn't address either of these two points specifically.
Thanks in advance for any help in this matter.
The command for setting the interface (8-bit/4-bit), display lines, and character font is 001DNF** where:
D - Interface length; 1=8-bit 0=4-bit
N - Number of display lines; 1=2 0=1
F - Character font; 1=5x10 0=5x7
So if I have a 20x4 display, how do I indicate 4 lines instead of just one or two? Do I just set it to 2 lines?
The second question I have is that according to the book I have on 44780-devices the start address of each line is:
1st line - 00H
2nd line - 40H
3rd line - 20H
4th line - 40H
This doesn't make sense that the 2nd and 4th line start at the same address. I got this from the book "Programming and Customizing the PIC Microcontroller 3rd Edition". However on a website I found they list it as this:
1st line - 00H
2nd line - 40H
3rd line - 14H
4th line - 54H
I found this at http://www.8052.com/tutlcd2.php. This seems to make more sense because, as I understand it, the 3rd line is a continuation of the 1st line and if a string more then 16 characters is written to the 1st line, it will automatically wrap to the 3rd. This also the reason why, I assume, you need to select 2 lines when initializing the LCD module?
Are my assumptions with this device correct? If I got something wrong I look forward to hearing the correct way to do this (especially the starting address of each line since I will be writing different data to each line so it is important for me to know this). I wish the datasheet was a little more clear on this.
The datasheet I found for the 44780 doesn't address either of these two points specifically.
Thanks in advance for any help in this matter.