Listing 3—I enjoy writing
utility routines from scratch, but when there’s a better wheel already rolling,
I tend to jump on it. The PICC-18 C compiler comes with a ton of utility routines
that are easily customized. I simply matched the PICC-18 C compiler LCD driver’s
I/O structure to the LAN buggy’s I/O pinout and added some LCD commands to the
existing example source code to get what I needed out of the 2 × 16 LCD module.
******************************************************************
// Modifications found in freds_lcd.h
******************************************************************
#define LCD_RS LATD4
#define LCD_EN LATA5
#define LCD_RW LATD5
#define LCD_DATA LATD
#define LCD_DATA_PORT PORTD
#define LCD_RS_TRIS TRISD4
#define LCD_EN_TRIS TRISA5
#define LCD_RW_TRIS TRISD5
#define LCD_DATA_TRIS TRISD