Interfacing an LCD to the MC9S08LC60, Rev. 0
Example Application Using the DEMO9S08LC60
Freescale Semiconductor
24
4.2.3.3
LCD Events / Interrupts
For the demo application, the LCD interrupts are initialized in lcddrv.h and the interrupt handler is found
in vectors.c. The LCD interrupt handler toggles the GPIO port (PTC2), configured as an output, which is
connected to the DEMO9S08LC60 speaker.
4.2.4
main()
The main() program function for this application is very simple, providing the following functionality:
•
Initialize ports, ICG, SCI, LCD
•
Initialize interrupts
•
Display the default message
•
Provide application loop
Below is the source code for the program loop in main():
//Program LOOP
while (1) {
//Check incoming data
result = AS1_RecvChar(&c);
if (result == ERR_OK ) {
sci_input[inputcounter] = c;//toupper(c);
inputcounter = inputc 1;
if (c == '\r') {
sci_input[inputcounter-1] = '\0';
string = sci_input;
Scroll_String(string, strlen(string));
inputcounter = 0;
cmdstring[0] = ' ';
for (i=0; i <= 30; i++) sci_input[i] = 0;
Table 9. String Argument Manipulation by the Scroll_String Function
String Argument
Manipulation Sequence
H
HE
HEL
HELL
HELLO
ELLO
LLO
LO
O