The 128×64 GLCD can be used to display text, logos, graphs, shapes and other useful bit images. To interface the GLCD with the LPC1768, we need 8 data pins and 6 control pins. In this tutorial, we will be using the KS0108 GLCD library from http://en.radzio.dxp.pl/ks0108/.
We will be discussing how to develop a program to run this library.
// data bus #define KS0108_DATA_DIR LPC_GPIO0->FIODIR #define KS0108_DATA_PIN LPC_GPIO0->FIOPIN #define KS0108_DATA_SET LPC_GPIO0->FIOSET #define KS0108_DATA_CLR LPC_GPIO0->FIOCLR #define KS0108_D0 16 // control bus #define KS0108_CTRL_DIR LPC_GPIO1->FIODIR #define KS0108_CTRL_SET LPC_GPIO1->FIOSET #define KS0108_CTRL_CLR LPC_GPIO1->FIOCLR #define KS0108_RS (1 << 18) #define KS0108_RW (1 << 17) #define KS0108_EN (1 << 16) #define KS0108_CS1 (1 << 20) #define KS0108_CS2 (1 << 19) #define KS0108_CS3 (0 << 21) #define DISPLAY_STATUS_BUSY 0x80
We have learned to use the KS0108 driver library from radzio.dxp and created a program to run the library using LPC1768 MCU. The code based on this tutorial is available in the Code Library