Instructions

Beginner’s Guide
to the
PI LCD
Part 4: Graphics
, W8BH
1) INTRODUCTION
In the first three parts of this series, we learned how to display text and simple graphics on
the LCD board (available from mypishop.com). It’s time to kick it up a notch, and create a
suite of useful graphics functions. We’ll even create a large-digit clock. You may have
purchased either a 16x2 or a 20x4 display with your kit. In this write-up I’ll be using the
20x4 display. When it comes to graphics, bigger is better!
2) SIMPLE HORIZONTAL BAR GRAPHS
An important requirement for creating detailed graphics is that the display device is dot-
addressable. In other words, each display pixel can be individually addressed and
programmed, separate from its neighbors. Sadly, our HD44780 controller does not give us
a dot-addressable LCD display. We get only pre-determined characters, plus 8 characters
of our own design. How can we possibly do artwork on that?
Well, we can’t. Go ahead, prove me wrong. Detailed graphics with this LCD module are
devilishly hard to do. But that doesn’t mean we can’t create useful, simpler graphics. Bar
graphs, for example.
First, consider a single, horizontal
bar graph. Here is our 20x4
display, with a horizontal bar that is
12 characters wide. If we need to
display data that over a small
integer range, like 0-15, we can do it by repeating the solid block (0xFF) character for the
desired length. You might code it like this:

Summary of content (15 pages)