compiler comes with a Math library and it is used with the
Graphics library automatically. Here are the drawing
functions of interest:
•line (x0, y0, x1, y1) — Draws a line from x0,y0 to
x1,y1 in VMAP.
•Rectangle (left, top, right, bottom) — Draws a
rectangle using top lefthand corner x,y to bottom
righthand corner x,y in VMAP.
•Circle (x, y, radius) — Draws a circle of radius
around center point x,y in VMAP.
•Bar (left, top, right, bottom) — Does the same as a
rectangle but fills it in.
An example code snippet for the shape displays is in
Outputting a Waveform
Outputting a waveform is really a
cool application for the Graphics
library. The drawing shown here is
“canned,” meaning it is not captured
data but calculated data — just to
illustrate the Graphics library drawing
capability. Its function is:
•plotxsinx () — Calculates and
plots an x times sin x function for
See Figure 10 for an example
Hook up the Experimenter and
display as shown in Figure 11.
Download the complete Microchip
project and source code from the Nuts
& Volts website. As mentioned in
previous articles, use Microchip’s Free
IDE and PIC24F compiler to compile
and then program the Experimenter
using the PICkit 2 programmer.
The Graphics demo application
initializes the display and runs through
a series of library features using a
number of separate screens. Between
each screen is a slight delay to allow
easy viewing before switching to the
next one. The MAIN code repeats
itself as a continuous loop.
Display Incoming Data
in Real Time
How about displaying real time
data as it is coming in to one of the
Experimenter‘s ADC input channels?
The Graphics library has a function
that supports this, as well.
•plotsignal (data array, number
of data samples, x offset, y offset) —
This function takes an array of data
samples and plots them in VMAP. The