Asynchronous Serial 4x40 LCD
The majority of character LCD's will use the HD44780 style controller which has a maximum capacity of 80 characters. How is it that we can still control a 4x40 display that now has 160 characters, simple, we control two. Since the maximum capacity is 80 characters the only way of increasing the capacity is to use more controllers, for this LCD we use two. There is very little difference with regards to control, all of the pins except for enable are tied together. To send information to the top two lines we use enable 1 and to control the bottom two lines we use enable 2.
Here the mechanical drawing for the LCD I will be using, more importantly the pin locations.
I'm not going to write another section of how LCD's work as I have already done so in a previous project, I will however give you a pinout diagram, a board layout and my program.
Before I chose to write this program I went straight ahead with building a circuit board, here is the pinout diagram for the microcontroller. I have chosen to go with the 16F690 due to it's more simple layout compared to the 16F628A. Note that there is a resistor network starting at RC4 and extending to RB7, RB7 has no connection, instead this is looped around to RC5. The value of the resistor is to be about 10k, it is used to pull down the inputs.
Here is a picture of the PCB design and here is the file - PCB
Here are a couple of pictures of my board, you may notice a few differences with the board above, at the time I wanted to see how close I could place the tracks, I had no issues. I also made the mistake of placing one of the dip switches against the unused TX pin, I have rerouted to a different pin in the above design and the program I will provide is intended for the board above.
As for the Software, below is a picture version or here is a - Text Version
The program has been made a lot more simple than the previous serial LCD project. First of all there is no splash screen, this is something that everyone would choose to disable, if they want one then the master chip would send a splash screen message to the LCD. There are now a lot more options for the baud rate which are stored in a lookup table. A simple command of 143 or 159 will select between the top two lines and the bottom two lines. A command of 254 will set the LCD into instruction mode for one command only.
Here is an example of the LCD working. Even though there are many baud rates to choose from I would still opt for 9600 or 19200 as the degree of error is small. You may have difficulties running at high speeds such as 115200, bits may be lost.
I hope this has been a useful addition to your project, of course you can still use this program for smaller displays, all you need to do is leave the enable 2 pin. Please check out my other projects for solutions or ideas.
Hello, if you have enjoyed reading this project, have taken an interest in another or want me to progress one further then please consider donating or even sponsoring a small amount every month, for more information on why you may like to help me out then follow the sponsor link to the left. Otherwise you can donate any amount with the link below, thank you!