LCD Navigator —
Part 1: the LCD
by Joe Pardue
Follow along with this
series! Joe’s book & kits
are available at
Discuss this article in the
Nuts & Volts forums at
Over the past several months, we looked at Digital
I/O (DIO). In Part 1 (October ‘ 11), we looked at the
software side of DIO as it is done in the Arduino using
sequentially numbered pins on the Arduino board. We
wrote a library of functions similar to the Arduino DIO
library functions but used regular C concepts and tools
■ FIGURE 1. LCD Navigator.
(AVRStudio, WinAVR, avrdude, avrlibc, etc.).
In Part 2 (November ‘ 11), we saw that the Arduino
pins are simple abstractions of the deeper AVR
microcontrollers’ concept of ports that are eight-bit arrays
of pins. We wrote a library that specifically handles ports
and their pins as they are used by raw AVRs.
Last month, we dropped the abstractions and looked
at how DIO is really done in AVRs using the tools
available in C, without having to write special libraries to
manipulate the ports and pins for DIO. We also went
deep into bitwise operators — a painful but necessary bit
of learning that is required if you really want to know what
C programming is all about (and microcontrollers in general,
for that matter). We applied all that to a simple chaser light
application that you can find at:
avrtoolbox. You can test it in hardware with the BreadboArduino
Projects kit available from the Nuts & Volts webstore.
We are now going to have some fun and apply what
we’ve learned about DIO by building something really
useful: an open source project that has an LCD and five
buttons used to navigate through menus shown on the
LCD. You can think of this as a tiny computer terminal and
keyboard; a very minimalist (read cheap) one for the AVR.
Like other Smiley’s Workshop projects, you can get the
parts kit from the Nuts & Volts webstore, as well.
Theory Section: Digital I/O in C
The C programming language knows nothing about
AVR DIO. C is a hardware independent programming
language and runs on any computer. The AVR is a specific
computer that does the same sorts of things that are done
by other microcontrollers (such as the 8051 or PIC), but it
does those things using different hardware. C abstracts the
sorts of things you can do with a computer into a higher-level concept that mimics a generic computer. C leaves it
up to the compiler to convert the C code into the actual