Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
![]() Slide 1: The 2 Line LCD Display and its HD44780 Controller | ||||||||
Line: 143 to 143 | ||||||||
Using the library | ||||||||
Changed: | ||||||||
< < | In addition to the prototypes, have a look at the doxygen documentation | |||||||
> > | In addition to the prototypes, have a look at the doxygen documentation | |||||||
and you should be able to program the display. |
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
![]() Slide 1: The 2 Line LCD Display and its HD44780 Controller | ||||||||
Line: 143 to 143 | ||||||||
Using the library | ||||||||
Changed: | ||||||||
< < | In addition to the prototypes, have a look at the doxygen ![]() | |||||||
> > | In addition to the prototypes, have a look at the doxygen documentation | |||||||
and you should be able to program the display. |
Line: 1 to 1 | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() Slide 1: The 2 Line LCD Display and its HD44780 Controller | |||||||||||||||||||||||||
Line: 37 to 37 | |||||||||||||||||||||||||
![]() | |||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||
> > | How to program the displayWe need to know: How to program the PCF8574 Understand the HD44780 display controller Understand the interface between the two Since the display can be used for many different purposes, writing a library is the thing to do! | ||||||||||||||||||||||||
Interfacing signals
| |||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||
> > |
A data byte to be sent
The I/O expanderAs you can see from the block diagram, the central part of the device is a shift register. It can actually do both:
![]() From the data sheet![]() Since the device will put all pins high with a low pull-up current, external signals can easily pull the pins low and thus you can read the state of these signals | ||||||||||||||||||||||||
Writing the to HD4780 controller via the PCF8574![]() | |||||||||||||||||||||||||
Line: 58 to 111 | |||||||||||||||||||||||||
After this instruction the 8 data bits of bVal lie at the input of the hd44780 controller.
| |||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||
< < | A data byte to be sent | ||||||||||||||||||||||||
> > | The HD44780 | ||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||
< < | We will therefore need a great deal of bit fiddling to | ||||||||||||||||||||||||
> > | The controller must generate the signals needed to driver the | ||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||
< < | create this data byte and to modify it to
| ||||||||||||||||||||||||
> > | LCD display and it must provide instructions to
| ||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||
> > | HD44780 block diagram![]() | ||||||||||||||||||||||||
The HD44780 libraryAs already explained several times, a library must supply: | |||||||||||||||||||||||||
Line: 120 to 178 | |||||||||||||||||||||||||
into the byte read before writing it back.
| |||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||
> > | HD44780 registersThe HD44780 has a single register select pin (RS) indicating that there must be writable 2 registers:
The DDRAMThe Display Data RAM stores data in 8 bit character codes. It has a size of 80 characters which in our case corresponds to 2 lines of 40 chars (of which only 2*16 will be used.![]() 2*16 character display![]() Converting the 8bit code to a dot matrixThe hd44780 contains a character ROM which will convert the 8 bit character code (mainly ascii code) to
Character Generator![]() Dot matrix and the display![]() Interfacing to the MPUThe HD44780 can be controlled with 8 or with 4 data bits.In 4 bit mode (this is what we use) with the lower 4 MPU bits connected to d4-d7 while the upper 4 MPU bits are used to drive. The hd44780 data lines d0 – d3 are disabled The upper four bits are used to drive
Instruction Summary![]() Instruction Summary (2)![]() Writing to the HD44780 in 4-bit modeIn order to write to the IR or DR of the HD44780 in 4-bit mode we must:
Strobe function![]() Writing a command and writing dataIn my library I define 2 functions:
hd44780WriteCmd![]() | ||||||||||||||||||||||||
Timing diagrams 4 bit mode![]() | |||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||
> > | The initialization procedure![]() Initialization Procedure (2)![]() Initialization procedure (code)These are the instructions: First we define the function set command (0x20) with bit 4 set to zero (4 bit interface) This is written as an 8 bit command (the lower 4 bits are not seen)![]() ![]() Now the controller switches to 4 bit format and from now on we have to write twice for each 8 bit word sent to the controller. We re-write the same command in 4 bit mode specifying the font (5*8 dots) and the no of lines = 2 in addition These bits were lost in the first (8 bit) transfer | ||||||||||||||||||||||||
%SLIDESHOWEND%
-- ![]() | |||||||||||||||||||||||||
Line: 135 to 347 | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||
| |||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||
| |||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||
> > |
|
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
![]() Slide 1: The 2 Line LCD Display and its HD44780 Controller | ||||||||
Line: 85 to 85 | ||||||||
Using the library | ||||||||
Changed: | ||||||||
< < | In addition to the prototypes, have a look at the doxygen documentation | |||||||
> > | In addition to the prototypes, have a look at the doxygen ![]() | |||||||
and you should be able to program the display. |
Line: 1 to 1 | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() Slide 1: The 2 Line LCD Display and its HD44780 ControllerThe 2 Line LCD Display and its HD44780 ControllerUli RaichUCC 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):
Our Display![]() Interfacing the display![]() The PCF8574 I2C interfaceThe 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 ![]() Interfacing signals
Writing the to HD4780 controller via the PCF8574![]() Writing to PCF8574 via pigpioEven 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:![]() A data byte to be sent
The HD44780 libraryAs already explained several times, a library must supply:
The function prototypes![]() Using the libraryIn 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 accessBefore starting to write the library we must first test if
Back lightTo 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![]() | ||||||||||||||||||||||||
%SLIDESHOWEND%
-- ![]() | |||||||||||||||||||||||||
Line: 11 to 131 | |||||||||||||||||||||||||
Comments | |||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||
> > |
|
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Added: | ||||||||
> > |
![]() Slide 1: The 2 Line LCD Display and its HD44780 ControllerThe 2 Line LCD Display and its HD44780 ControllerUli RaichUCC semester 2017/2018--![]() Comments |