Exercise 11: The LCD Display
Goal:
The main goal of this exercise is to prepare for an exercises on Analogue to Digital Conversion (ADC). In the ADC exercise we will convert analogue signal levels (or real time analogue signals) and the results must be displayed somehow. This can of course be done on a terminal display but it is much nicer to see the results on a dedicated LCD display.
In conjunction with analogue to digital conversion we can easily build our own voltmeter.
The display consists of 2 parts: The display proper controlled by a
hd4478 and the interface part. It is possible to connect the display part straight to the GPIO lines of the Raspberry Pi, however this would require plenty of wiring. We therefore use a
pcf8574 8-bit I/O expander, which can be considered a sort of serial to parallel converted. With only 4 connections (the usual
I2C SDA SCL lines + power and gnd) we can generate 8 I/O lines to drive the hd4478 display controller.
The LCD Display
The pcf8574 8bit I/O expander
In order to be able to program the device we must of course know, how the pcf8578 is connected to the hd4478 and it is the circuit diagram which shows us all the connections:
Exercise 1: Hello World version 1
Use the hd44780 library which contains most of the calls you may need to access the 2-line display. Try to write "Hello World!" onto the first line of the display.
You find the description of the library either in its source code when running
doxygen in its source directory or, when connected to the Raspberry Pi at this URL:
https://dcsit.twiki.ucc.edu.gh/html/libDoc/hd44780/
Exercise 2: The name display
Try to re-do the
name display program we showed off during the Open Day: A program asks a visitor to type his name.
Once he is done, the program writes:
DCSIT welcomes
name of the visitor
to the LCD display.
Exercise 3: Hello World version 2
Try to write Hello World to the display but this time without passing through my library.
This “Hello World!” program is a bit more complex than what you may know from your C programming course. The goal is to display the text “Hello World!” on the LCD display.
Exercise 4: A small display library
Create a display library, which allows its user to write any text to any of the 2 lines on the display. This library you will use in a later exercise, when you will build a voltmeter. Of course you must also write a test application to make sure your library calls all work as expected.
--
Uli Raich - 2017-08-20
Comments