■ FIGURE 2. EA DOGM
internal memory and
pixel position map.
Control of the display is through Synchronous
Peripheral Interface (SPI) for initialization, setting pixel
contrast, pixel addressing, and pixel on/off. The use of SPI
really simplifies interconnection between the Experimenter
and the display. Only a few control lines plus power and
ground are needed.
To support the internal workings of the display, a total
of nine 1 µF external capacitors are needed as shown in
Figure 3. The backlight which mounts under the display
requires three 100 ohm resistors to current-limit the three
integrated LEDS within the backlight. Make sure when
mounting the display on the backlight to remove all the
protective films, labels, and papers that are on the
components. If left on (and the units are soldered
together), they will form a permanent shadow and will
block the light. This takes away from a clean display.
A timing diagram for the SPI is also shown. The SPI
data out is clocked eight bits at a time. All communication
between the Experimenter to the display is one way —
only the Experimenter talks. The command or data
indication (A0) must be valid during transfer. The EA
DOGM brochure lists a table of all the programming
commands to properly initialize the display. The ‘C’
Graphics library does this as well as handles all
communications with the display.
Introducing the Graphics Library
To help use the capabilities of the DOGM, a Graphics
library is included. This library provides an Application
Programming Interface (API) that is really just a bunch of
C functions and rules. We will discuss each of these with
examples. The library lets you draw lines, bars, circles,
triangles, rectangles, and bitmaps, plot data, and output
text. These parts of the library API are the graphic
primitives. However, in order to use these primitives a lot
of low level drivers are required.
Most of these low level drivers function when the
primitives are actually drawing, with the exception of
initializing the SPI and display — this has to be done by
you. The library was written using the Microchip PIC24F C
compiler and occupies about 6,018 bytes of Flash and
■ FIGURE 3. The
Experimenter
and display
hardware
interface.
1,264 bytes of RAM. The library is fully contained in three
files: Font.h (which contains the bit images for the
different character fonts); Graphics.c (the library source
code); and Graphics.h (a list of library functions for main
code reference).
These must be included in the project and the
FONT.H and GRAPHICS.H must appear in the MAIN
code using the compiler directives #include FONT.H and
#include GRAPHICS.H. A GRAPHICDEMO project is
available from the Nuts & Volts website at
www.nutsvolts.com to experiment with and use as a
template for applications. The library assumes that the
Experimenter I/O expansion bus is configured for SPI and
digital control outputs. This I/O programming is
accomplished at the beginning of the MAIN code in
GRAPHICDEMO.
The VMAP, Bitmaps, Font, and
Graphics Library Operations
There are several aspects in using the library to be
aware of. The library requires — and sets up — a dedicated
RAM area within the Experimenter PIC24F designated as
VMAP. It is here where all the drawings occur prior to
display. The VMAP RAM area is a C array that is
configured as a linear memory map 128 bytes x 8 bytes,
representing all pixels on the display. VMAP contents are
manipulated using the graphic primitives and then
dumped onto the display for a drawing or screen
presentation. The VMAP is used to do the drawing and
then the low level driver “dumpVmap ()” is used to
transfer the contents to the display.
■ FIGURE 4. Graphics library
components.
April 2010 33