You will put all your LCD routines into a file called graphics.c. Amoung
other things this file will contain the bitmaps for the ascii characters.
The initialization sequence of the Newhaven display needed some
minor tweeks to make it work in our application. Below is my
initialization sequence used to generate the test file used in
lab3. For each command below identify the command and its function.
Function | Description
|
void INIT_LCD(void)
| Initializes the LCD,
|
void SEND_DISP(int8 mode, int8 data)
| Send the data to the display in the specified mode. The
function should check the SSPIF before transmitting to insure
the the transmitt buffer is not overrun.
|
void WRITE_STRING(int8 row, int8 col, char *ptr, int8 plane[128][4])
| Writes the NULL terminated string to the display.
|
void POINT(int8 x0, int8 y0, int8 plane[128][4])
| Draws a point at location (x0,y)
|
void CHANGE_MODE(int8 mode)
|
Mode | Effect
| OVER | Overwrites anything on the graphics plane
| AND | ANDs new pixels into the graphics plane
| OR | ORs new pixels into the graphics plane
| XOR | XORs new pixels into the graphics plane
|
|
void INIT_PLANE(int8 display[128][4], int8 color)
| Clears all the pixels in the graphics plane to the
defined color (black=1, white=0).
|
void COPY_PLANE(int8 src[128][4], int8 dest[128][4])
| Copys the pixels from the source plane into the
destination plane.
|
void SEND_PLANE(int8 display[128][4])
| Sends the pixel array pointed to by display to the LCD.
|
void LINE(int8 x0, int8 y0, int8 xf, int8 yf, int8 plane[128][4])
| Draws a line on the LCD starting at (x0,y0) and finishing
at (xf,yf)
|
void CIRCLE(int8 x, int8 y, int8 radius, int8 plane[128][4]);
| Draws a circle at x,y with the specified radius
|
void SPRITE(int8 *sprite, int8 width, int8 height, int8 x, int8 y, int8 plane[128][4])
| Mask in the 2-D sprite with dimensions width x height into the
graphics plane at location x,y
|
Its up to you to write an application which demonstrates that these functions
work. You can write a simple terminal application, use the push buttons, or
build a simple game of tic-tac-toe. Its your call.