// Setup timers, configure ports and
// initialize variables
Setup Timers();
// Initialize the LCD Display
InitializeLCD();
// This test will display integer values
// from 0 to 255
while (1) // Forever
{
for (i=0; i<256; i++)
{
times!!!\n”, i);
printf(“Testing %d
pause(500);
}
}
LISTING 2. An example of how to print integer
values or hex values to the LCD display.
ground pins, and by connecting the VCC pin to one of the
microcontroller’s 5V power supply pins (also shown in the
schematic). The only external component (other than the
LCD module) required is a 10K ohm trim potentiometer
which is used to control the LCD contrast function. Use it to
insure that text is visible on the display under various
lighting conditions (indoor, outdoor sunlight). Some newer
displays have two extra pins (power and ground) for an LCD
backlight. If this is the case, then use the manufacturer’s
recommended voltages for the backlight.
Bill of Materials
The parts required to build the LCD display circuit are
shown in Table 2. Other than the microcontroller, the other
components are relatively low cost and can be found at
your local RadioShack, or on the Internet at Jameco.com
or SparkFun. The optional jumper cables make it very easy
to connect an LCD to the controller, but should only be
used for temporary connections since they can easily pull
out of the controller.
LCD Display Firmware
Connecting the LCD to the VEX Controller
From the schematic shown in Figure 3, you see how
simple it is to connect the LCD to the microcontroller’s
digital output pins. Just solder .100 pin headers to the LCD
module to wire-wrap or jumper the connections. Another
connection alternative is to use the pin headers with a
ribbon cable for a more rugged display.
The LCD obtains its power directly from the
microcontroller by connecting the VSS pin to one of its
If you want to run a simple test of the LCD to make
sure that it works, then download the lcd.hex file using the
IFI bootloader. Once you have verified the correct operation
of the LCD, you can start using it for your own VEX
applications or to customize the drivers. The PIC18 C code
that drives the LCD is located in lcd.c. Included in this file
are functions to position the cursor, display text characters
at a specific line and column, and display text strings.
FIGURE 4. Another
character LCD display that
I connected to the VEX
controller which is a surplus
two line by 24 character
display that I purchased
online for around $10. The
two lines and 24 character
line length allow you to
display even more
information including
floating point values and
more detailed text
messages.
64 SERVO 06.2010