Interfacing an LCD to the MC9S08LC60, Rev. 0
Example Application Using the DEMO9S08LC60
Freescale Semiconductor
20
LCD drivers to write to the display are simple to implement after the relationship of the LCD segments to
the LCD RAM is determined. For this example application, the method to determine the LCD segment to
LCD RAM relationship was described in
also discussed an approach to display
alphanumeric characters. This approach will be implemented in software.
4.2.3.1
LCD Initialization Drivers LCD_init()
In the example application, the initialization is accomplished via the LCD_init() function. The source code
for LCD_init() is provided below. LCD_init() calls functions that configure the power, clocks, and other
parameters for the LCD. Many of these parameters are compile time decisions. Each of the functions called
by LCD_init() can be found in lcddrv.c.
void LCD_init() {
//Configure clock source
CONFIG_CLKSOURCE();
//power supply configuration
SET_CONFIG_VSUPPLY();
//Configure operation in stop/wait
SET_LCDCR1_REG();
//Configure frame frequncy
SET_LCD_FRAME_FREQU();
//Configure blink rate
CONFIG_BLINKING( 2 /* Hz*/, OFF);
//Enable Frontplanes
ENABLE_FP();
//Enable LCD
ENABLE_LCD(ON);
//Map RAM to ARRAY
MAP_LCDDRIVER_TO_LCDGLASS();
}
The example application uses lcddrv.h to set up the LCD module power, clock, and other initialization
options using several define directives. Some of these directive-defined variables are also tied to variables
defined in cpu.h because LCD clock configuration parameters are dependent on the ICG configuration. An
excerpt of variables defined in lcddrv.h is provided below, and shows the options for LCD power
configuration and LCD duty cycle.
//===========================
//LCD power configuration
//===========================
#define LCDPWR_VDD 1
#define LCDPWR_VLCD 0
#define LCDPWR_VLLLN 0
.
.
.