Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

TYBTECH ET343 Embedded System

Design

Practical No. 02 Date:

Interfacing of Graphical LCD with LPC1768

OBJECTIVE

• To study the features of LPC1768 core and graphical LCD

• To interface graphical LCD with the LPC1768 development board

• To explore the slow GPIO structure of LPC2148

EQUIPMENTS

• LPC1768 Micro–A748 Development Board

• Keil µvision IDE enabled PC

• Graphical LCD Display

THEORY
Graphical LCD module interfaced with LPC1768 Micro–A748 development
board,following are some specification of GLCD

• 128 × 64 dots/pixel

• 8-bit parallel interface

• 8 data lines
TYBTECH ET343 Embedded System
Design

Figure 1: Interfacing of graphical


LCD

Graphical LCD Signals

• LCD Data Lines : D0 – D7

– 8 bit bidirectional data bus


– Used to send information to the GLCD
– Read the contents of internal registers

• LCD Control Lines


RS : Select data or command/status register

R/W : Read / Write select control line

E : Latches information

CS1 & CS2 : Chip SelectSignals

RESET : LCD Reset signal

Registers of GLCD

1. GLCD Input Register


It is used while giving instructions and writing data to LCD. It holds the
data/instruction temporarily before writing to the DDRAM (Data Display
RAM)
TYBTECH ET343 Embedded System
Design

2. GLCD Output Register


It is used to read data from DDRAM and to check status data (busy check)

3. When LCD is in active mode (CS1 & CS2 are high), the registers can
beselected by sending bits on RS and RW pins as shown in the table below

Figure 2: Graphical LCD


Registers

Figure 3: GLCD Pin Configuration


TYBTECH ET343 Embedded System
Design

Basic Operations of GLCD

1. GLCD Initialization

• CS1=1, CS2=1 (to activate display of both halves)


• RS=0, R/W=0 (to select the instruction mode)
• EN=1, Delay, EN=0 (to latch data into the input register)

2. Column Selection

• RS=0, R/W=0 (to select the instruction mode)


• EN=1, Delay, EN=0 (to latch data into the input register)
• The corresponding controller (CS1 or CS2) is selected depending on the
Column number

3. Data Display

• RS=1 and R/W=0 (to select write mode of LCD)


• EN=1, Delay, EN=0 (to latch data into the input register)

To display Image

• For an image to be displayed on GLCD, the image must have following features:

– It should be in BitMap (.bmp) format


– It should be black and white (1 bit per pixel)
– The image is not compressed
– Its size should be 128 x 64 pixels

• The hex code for an image can be generated from any of the bitmap code
generating software available on internet.

• These codes are stored in an array and the array is stored in a header file with
‘.H’ extension.

• This header file must be included in main program


TYBTECH ET343 Embedded System
Design

Figure 4: GLCD Data Format

INTERFACING DETAILS/CONNECTIONS
TYBTECH ET343 Embedded System
Design

REFERENCES

1. Andrew Sloss, Dominic Symes, Chris Wright, “ARM System Developer’s


Guide
– Designing and Optimizing System Software, ELSEVIER.

2. LPC 176x User manual (UM10360) : www.nxp.com

3. ARM architecture reference manual : www.arm.com

PROGRAM

#include "lpc1768_Includes.h"
#include "temp1.h"

#define datalines 0x00000FF0 // data lines


#define en 1<<26 // p1.26
#define rs 1<<25 // register select p1.25
#define CS1 1<<27 // chip select CS1 p1.27
#define CS2 1<<28 // chip select CS2 p1.28
#define rw 1<<29 // p1.29

void Glcdcmd(unsigned int);


void Glcddata(unsigned int);
void MSDelay(unsigned int);
void Glcd_disp(const unsigned char *);
int main()
{
PINSEL3=0x00000000;
PINSEL0=0x00000000;
FIO1DIR= 0x3E000000 ;
// o/p port 1 cntrl lines 29,28,27,26,25,0011 1110000
FIO0DIR= 0x00000FF0 ;
// o/p port 0 data lines 4, 5, 6, 7,8, 9, 10, 11

FIO1SET=CS1;
FIO1SET=CS2;
Glcdcmd(0x3F); //Display ON
MSDelay (10);
Glcdcmd(0x40); //Set Y address as 0(range 0-63)
MSDelay (10);
Glcdcmd(0xB8); //Set X add- 0(page adds)(range 0-7)
MSDelay (10);
Glcdcmd(0xC0); //Set Z address (start line=0)
MSDelay (10);

Glcd_disp(audi);
//Calling display function, abc is name of array
TYBTECH ET343 Embedded System
Design

MSDelay (10);
}

void Glcd_disp(const unsigned char *temp1) //display routine


{
int i,j;
for(i=0;i<8;i++) //page
{
FIO1SET = CS1; //select controller 1
FIO1CLR = CS2;
Glcdcmd(0xB8 | i); // Increment page address
Glcdcmd(0x40);
for(j=0;j<64;j++) //display controller 1 data
{
Glcddata(temp1[(i*128)+j]);
}

FIO1CLR = CS1; //select controller 2


FIO1SET = CS2;
Glcdcmd(0xB8 | i); // Increment page address
Glcdcmd(0x40);
for(j=64;j<128;j++) //display controller 2 data
{
Glcddata(temp1[(i*128)+j]);
}

}
}

void Glcdcmd(unsigned int cmd)


{
FIO0CLR=datalines;
FIO0SET=cmd<<4; //LCD_SHIFT;
FIO1CLR=rs; // rs=0 command register
FIO1CLR=rw; // R/W=0
FIO1SET=en;
MSDelay(10);
FIO1CLR=en;
}
void Glcddata(unsigned int data)
{
FIO0CLR=datalines;
FIO0SET=data<<4; //LCD_SHIFT;
FIO1SET=rs;
FIO1CLR=rw;
FIO1SET=en;
MSDelay(10);
FIO1CLR=en;
}
void MSDelay(unsigned int itime)
TYBTECH ET343 Embedded System
Design

{
unsigned int i,j;
for(i=0;i<itime;i++)
for(j=0;j<10;j++);

OUTPUT:
TYBTECH ET343 Embedded System
Design

CONCLUSION:

You might also like