Overview
A character LCD based on HD44780 is popular due to ease of programming. However, its interface is 8-bit parallel mode. Software technique could reduces the 8-bit interface to 4-bit mode, but it still require additional control pins.
A finished Assembling. SN74HC595N is soldered on-board. A 16x4 LCD stays at the top. |
Soldering side |
With SN74HC595N, the interface from the MCU to this LCD could reduce in pins requirement. SN74HC595 acts as an interface converter from SPI to parallel output. Using this device, the MCU uses only three pins:
- Serial Clock
- Serial Data
- Enable Pin
And it needs two extra supply pins.
Because of its low cost, I decided to make my own LCD adapter board for this chip. I possess a lot of shift register and character LCD module. I design my own schematic and PCB. The PCB is printed in my personal workshop.
Proteus 8 is very easy to design schematic and PCB due to its simplicity and light weight in components database and design rules.
Schematic Diagram |
A photo of finished PCB design |
Copper side |
Components side |
A software rendered 3D view |
Full design work could download here.
Arduino Interfacing And Programming
Library for this kind of LCD is widely available online. There are many authors make this libraries. I use a library develops by an author shared on Github.
For connection between Arduino Uno to this LCD module, wire as follow.
Arduino To SPI LCD connection diagram |
I took the example program come with this LCD library.
The HelloWorld.ino Example Program |
The HelloWorld.ino tested on physical hardware |
There are some basic function in this library.
- LiquidCrystal lcd(x) - Where x is any pin (slave select). This object must declare first prior to LCD function usage.
- lcd.begin(cols,rows) - Set number of rows and column for character LCD, typically it is 16 columns and 2 rows.
- lcd.setCursor(x,y) - Set the cursor before writing to LCD. Both x and y start from 0.
- lcd.print() - Print any string or number value to LCD
- lcd.clear() - Clear LCD screen
There are many functions left as referred in library function on Github.
Now I try to test my own program for this LCD using existing library.
Another Test Program |
Arduino file could download here.
Physical hardware test |
We can also control this SPI LCD module using the ATMega32. Another simple method is using the SN74HC164 serial to parallel shift register IC. It need three pins of microcontroller.
No comments:
Post a Comment