102 horizontal by 64 vertical, for a total graphics
complement of 6,528 pixels. By using a fixed font of 8x8
pixels per character, this display (using new software)
emulates a 12x8 LCD character display (see Figure 3).
Here’s the LCD display software library. The functions
and their use are straightforward. This library is used to
write strings onto the graphics display.
• void LCDInit(void) – Called once to initialize the display
and Experimenter I/O.
• void LCDUpdate(void) – Updates the entire display
with contents of LCDText.
• void LCDErase(void) – Clears the entire display and
content of LCDText.
• void LCDWriteLine(WORD number, char *line) —
Updates a designated row (indicated by number 1 to 8)
on the display.
FIGURE 3. LCD
The good news is that the above four functions mimic
Microchip’s LCD interface for their family of evaluation
boards using a character display, and are used extensively
throughout their applications library. So, if you want to host
their library applications on the Experimenter, just replace
their library function LCDBlocking.H and LCDBlocking.C
with our Graphics.h and Graphics.c. Everything should
compile and work without issue. A demo program is
provided that illustrates the use of this LCD library. Open
LCDtest.MCP in the LCD folder, (included with the article
downloads) build, and then program an Experimenter
equipped with a universal graphics module. You should
see what’s in Figure 4. There are also additional library
functions used to write characters onto the display:
FIGURE 4. LCD string display test demo.
components that are pre-assembled. The module does
come as a kit (available at
www.nutsvolts.com). The only
assembly requirement is to solder the display and backlight
to the board, as well as the headers to the board.
• AT (X, Y) — Macro to position the cursor on the display
before writing a character. X is 0 to 11; Y is 0 to 7.
• putcV (char) — Writes a character to the display
memory at the current cursor position.
• dumpVmap () — Updates the display with new characters.
Finally, there are functions in the display library that
provide independent control of the two LEDS (green/red)
on the display module, as well as the LCD display backlights
(which are also green and red). The green backlight has a
controlled brightness feature. The red backlight is simply
on or off. Feel free to activate both and experiment with
the color mix to “jazz up” your display operations.
• void redBLON(void) — Turn red LCD backlight on.
• void redBLOFF(void) — Turn red LCD backlight off.
• void greenBLOFF(void) — Turn green LCD backlight off.
• void greenBLON(int setting) — Turn green LCD
backlight on with dim setting (0 to 64K), where 0 is
dimmest and 64K is brightest.
• void greenLEDON(void) — Turn green LED on.
• void greenLEDOFF(void) — Turn green LED off.
• void redLEDON(void) — Turn red LED on.
• void redLEDOFF(void) — Turn red LED off.
The graphic module board itself contains SMT
The PS/2 Keyboard
A keyboard provides a powerful input capability for
Experimenter applications. With the advent of USB
keyboards, the PS/2 versions have pretty much been
replaced, but still exist in large quantities and are available
at low cost. First, we will discuss PS/2 operation and then
how the Experimenter integrates to a PS/2 keyboard.
Historically between the PS/2 and the computer, there
can be an extensive host-device protocol involved. For our
purposes, we will simply stick to receiving key scan data
from the keyboard, deciphering these key scans into ASCII,
and then displaying this data on the Experimenter LCD display.
We’ll avoid any of the more difficult command features as
they are not necessary for this terminal experiment.
Let’s first examine the PS/2 physical interface. The
PS/2 keyboard requires +5V to operate and generates its
own data clock. PS/2 communications use a framed
synchronous serial protocol to transfer data. The
communication is “idle” when both lines (data and clock)
are high (open-collector). This is the only state where the
keyboard is allowed to begin transmitting data. The
microcontroller has ultimate control over communications,
and may inhibit communication at any time by pulling the
clock line low. Figure 5 shows the physical connector with
October 2011 51