Issue
158 September 2003
The
XY-Plotter
Drive
High-Resolution LCDs For Less
Mad
Dash for Flash Cash Contest Winner
TEXT
DISPLAY
The
three text lines are also generated on the fly based
on the ASCII characters that are stored in RAM. For
this purpose, a specific character bitmap was precalculated
and stored in flash memory. The table gives the successive
nibbles to send to the display for each character (from
back to top and from left to right). Each character
is encoded in an 8 × 12 pixel bitmap, giving 30 (240/8)
characters per line.
A
significant overhead is needed at the start of each
character (first scan line out of the eight) in order
to precalculate the different pointers. I built this
unusual character bitmap table in Excel, starting with
a standard 8 × 12 bitmap I found on the Internet.
LINE-BATCH
ROUTINE
The
line-batch routine manages the acquisition of the x
and y analog values as well as the storage of the minimum,
maximum, and sample values in RAM. I built the routine
as a five-stage step machine (see Figure 9). Each step
corresponds to a different acquisition sequence.
|

(Click
here to enlarge)
|
Figure
9—The acquisition of the x and y analog values is
managed thanks to a five-state machine executed
each time the line-batch routine is called (each
65 µs). This allows you to comply with the PIC ADC
timing (precharge, conversion, and then read) without
losing any time. |
You
can’t lose time with this architecture. A full pair
of x and y values is acquired every 260 µs (4 × 65µs),
which produces a satisfactory 3.8-kHz update rate. Depending
on the scan rate you apply (i.e., the frequency of the
saw-tooth applied on the x input), two modes are automatically
executed. If the scan rate is lower than 15 Hz (3.8
kHz/256) or the scan time is higher than 7 ms per division
(1/15 × 10) using the usual scope vocabulary, then more
than one y value is acquired for each x value per scan,
enabling functionality such as minimum, maximum, and
peaks.
If
the scan speed is higher (up to 500 Hz), an equivalent
time-sampled display is generated, and minimum, maximum,
and peak measurements are only available in Accumulate
mode (i.e., no resetting of the minimum and maximum
between scans).