Exercise 10:

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.

2linedisplay.png

The LCD Display

i2c_pcf8574.png

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:

pcf8574ifce.png

Exercise 10.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://afnog.iotworkshop.africa/libDoc/hd44780/

Exercise 10.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 10.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 10.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.

-- Isaac Armah-Mensah - 2018-11-29

Comments

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatgz hd44780.tar.gz r1 manage 250.7 K 2019-12-09 - 11:37 IsaacArmahMensah  
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2019-12-09 - IsaacArmahMensah
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback