create new tag
view all tags

Exercise 11: The LCD Display


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:


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


Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng 2linedisplay.png r1 manage 873.1 K 2017-08-20 - 09:00 UnknownUser  
PNGpng i2c_pcf8574.png r1 manage 1014.0 K 2017-08-20 - 09:00 UnknownUser  
PDFpdf led.pdf r1 manage 66.5 K 2017-11-27 - 10:36 UnknownUser  
PNGpng pcf8574ifce.png r1 manage 63.7 K 2017-08-20 - 09:00 UnknownUser  
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2017-11-27 - uli
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback