Difference: Lecture11:The2LineLCDDisplay (1 vs. 2)

Revision 22017-11-06 - uli

Line: 1 to 1
 
META TOPICPARENT name="LectureSlides"

Start Presentation

Slide 1: The 2 Line LCD Display and its HD44780 Controller

The 2 Line LCD Display and its HD44780 Controller

Uli Raich

UCC semester 2017/2018

Added:
>
>

Why a simple 2 line display?

Often embedded systems do not have a screen, keyboard and mouse associated with them.

Small devices in the field may nevertheless need to display some values to the user

Small and cheap LCD displays can take over this task

Our display can be used for many purposes (see the open day):

  • Name display
  • Weather station
  • Voltmeter
and there are many more applications

Our Display

2linedisplay.png

Interfacing the display

pcf8574ifce.png

The PCF8574 I2C interface

The PCF8574 I2C I/O expander allows to limit the number of connection wires to just four.
It is a kind of a shift register: serial in, parallel out

i2c_pcf8574.png

Interfacing signals

The display needs a large number of interface signals
to be able to work:

  • Min. 4 data lines
  • R/W line
  • register select
  • back light
  • back light power
  • power
  • gnd

Writing the to HD4780 controller via the PCF8574

pcf8574write.png

Writing to PCF8574 via pigpio

Even though it looks complicated at first sight,

writing a data byte to the hd44780 controller via the

pcf8574 I/O extender is actually pretty simple:

i2c_write_byte.png

After this instruction the 8 data bits of bVal lie at the input of the hd44780 controller.

A data byte to be sent

We will therefore need a great deal of bit fiddling to

create this data byte and to modify it to

  • Set the back light on or off
  • To send a pulse on the E (strobe) line
Hope you remember the

  • bitwise or operator: |
  • bitwise and operator: &
  • bit inversion: ~

The HD44780 library

As already explained several times, a library must supply:

  • The binary code: libhd44780.so
  • The include file hd44780.h

The function prototypes

libFunctions.png

Using the library

In addition to the prototypes, have a look at the doxygen documentation

and you should be able to program the display.

Of course you have to include

-I/opt/ucc/include in your CFLAGS

-L/opt/ucc/lib in your LDFLAGS

and -lhd4780 in your LDLIBS

However, we want to understand what is happening behind the scene!

Testing access

Before starting to write the library we must first test if

  • We can initialize the device ?
  • We can write something to it and read it back ?
  • Or can we find any other function showing us that the device responds?

Back light

To give us some confidence, let’s try to switch the back light on and off:

This one is easy as it does not access the hd44780.

It does test the PCF8574 though!

Switching bit 7 in the data word does the trick.

Later we will read a byte from the display and and/or bit seven

into the byte read before writing it back.

Timing diagrams 4 bit mode

4bitdataTransfer.png

 %SLIDESHOWEND%

-- Uli Raich - 2017-11-06

Line: 11 to 131
 

Comments

<--/commentPlugin-->
Added:
>
>
META FILEATTACHMENT attachment="4bitdataTransfer.png" attr="" comment="" date="1509982394" name="4bitdataTransfer.png" path="4bitdataTransfer.png" size="28652" user="uli" version="1"
META FILEATTACHMENT attachment="4bitTransfer.png" attr="" comment="" date="1509982394" name="4bitTransfer.png" path="4bitTransfer.png" size="24602" user="uli" version="1"
META FILEATTACHMENT attachment="displaySignals.png" attr="" comment="" date="1509982394" name="displaySignals.png" path="displaySignals.png" size="16398" user="uli" version="1"
META FILEATTACHMENT attachment="initProc1.png" attr="" comment="" date="1509982394" name="initProc1.png" path="initProc1.png" size="30639" user="uli" version="1"
META FILEATTACHMENT attachment="initProc2.png" attr="" comment="" date="1509982394" name="initProc2.png" path="initProc2.png" size="28344" user="uli" version="1"
META FILEATTACHMENT attachment="libFunctions.png" attr="" comment="" date="1509982394" name="libFunctions.png" path="libFunctions.png" size="29147" user="uli" version="1"
META FILEATTACHMENT attachment="pcf8574ifce.png" attr="" comment="" date="1509982394" name="pcf8574ifce.png" path="pcf8574ifce.png" size="65250" user="uli" version="1"
META FILEATTACHMENT attachment="strobe.png" attr="" comment="" date="1509982394" name="strobe.png" path="strobe.png" size="69961" user="uli" version="1"
META FILEATTACHMENT attachment="2linedisplay.png" attr="" comment="" date="1509982432" name="2linedisplay.png" path="2linedisplay.png" size="894036" user="uli" version="1"
META FILEATTACHMENT attachment="i2c_pcf8574.png" attr="" comment="" date="1509982435" name="i2c_pcf8574.png" path="i2c_pcf8574.png" size="1038370" user="uli" version="1"
META FILEATTACHMENT attachment="pcf8574write.png" attr="" comment="" date="1509984483" name="pcf8574write.png" path="pcf8574write.png" size="34655" user="uli" version="1"
META FILEATTACHMENT attachment="i2c_write_byte.png" attr="" comment="" date="1509984637" name="i2c_write_byte.png" path="i2c_write_byte.png" size="15228" user="uli" version="1"

Revision 12017-11-06 - uli

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="LectureSlides"

Start Presentation

Slide 1: The 2 Line LCD Display and its HD44780 Controller

The 2 Line LCD Display and its HD44780 Controller

Uli Raich

UCC semester 2017/2018

-- Uli Raich - 2017-11-06

Comments

<--/commentPlugin-->
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback