|
Using
a Graphics-Based LCD
Module with C
by Bob Perrin and Tak Auyeung
Start
Software Overview
The Bottom Layer Initializing
the LCD Display Shadow
Display Drawing Dots
and Lines Printing
Text Extensions
Sources and PDF
SOFTWARE OVERVIEW
The software referenced
in this article can be downloaded,
the zip contains two files glcd.c and glcd.h.
You can also download them from www.mobots.com.
The C code in glcd.c
implements the API level functions as shown in Table
1. These functions constituted a minimally functional
API for a graphics-based display. Because the code
is written completely in ANSI C, it should be portable
to your target system and easily modified to suit
your application.
| Function |
Description |
| lcdInit() |
initialize the
LCD |
| scrSetBrush() |
set the global
paintbrush |
| scrDrawDot() |
draw a pixel |
| scrDrawLine() |
draw a line |
| scrFillBox() |
draw and fill
a rectangle |
| scrFill() |
fill the screen |
| fntLoad() |
load a font |
| fntUnload() |
unload a font |
| scrDrawChar() |
draw a single
character |
| scrDrawString() |
draw a string |
| Table
1The API level functions are implemented
by the C code in glcd.c. |
The HDG12864F-1 COG
module uses an Epson SED1565 LCD controller. If
you want to modify the drivers, get Epsons SED1565
Technical Manual. [3] There is also a datasheet
for the SED1565, but the Technical Manual is much
more useful.
If you want to do additional
software modifications specifically for the JK Microsystems
V25+ Flashlite, get the V25+ and V35+ Users Manual
from NEC. [4] Unfortunately, this publication is
only available in print (not PDF), so you need to
request it from NEC directly. You may be able to
do this over the Internet, but we had better luck
with the literature request phone line at (800)
366-9782.
OBJECTIVES AND SPECIFICATIONS
The main objective
of the software driver of the graphics LCD is to
provide an application programming interface (API)
to isolate the application software from the details
of the LCD hardware. With the proper API, any change
to the graphics LCD hardware should not significantly
affect the application program.
With a graphics LCD,
an application can display both graphics and text.
Therefore, it is important to supply methods to
display text and graphics. For emphasis (or to save
screen space), it is helpful to be able to use fonts
of multiple sizes and shapes. The basic graphics
primitives include dot plotting, line drawing, as
well as filled rectangles.
Other useful methods
include the ability to display bitmaps from a file
and capture bitmaps to a file. However, these methods
are not necessary to illustrate how to use a graphics
LCD.
The driver software
referred to in this article is developed using Borland
C++ 4.52 and mostly ANSI-C compliant constructs
with no "C++ only" constructs. The FAR
keyword is not ANSI compliant, but is required by
the Borland compiler to access the special function
registers in the V25+. [1] The intentional avoidance
of C++ constructs allows more developers to use
the sample code.
PREVIOUS
NEXT
|