Understanding of GLCD interfacing

To interface GLCD with microcontroller, two registers are used named as Input and Output register . These registers are selected by the combination of RS and RW signals.

Input Register : Input Register is used to hold command or data writing to GLCD. When the LCD is in active mode (CS1 and CS2 high), the Input register can be selected by sending bits on RS and RW pins as shown in the following table. The data of input register is written to DDRAM when the falling edge (from high to low) of EN (Enable) signal detected.

Output Register : Output Register is used to read data from DDRAM (to check the busy status of GLCD). When the LCD is in active mode (CS1 and CS2 high), the Output register can be selected by sending bits on RS and RW pins as shown in the following table. When R/W and RS are high (mean ‘1’) , data is loaded into output register and when R/W=1, RS=0, status can be read out.

R/W

RS

Function

     

0

0

1

Send instruction

Data write (from input register to DDRAM)

1

0

1

Status check (Busy Read)

Data read (from DDRAM to output register)

The basic operation with GLCD requires following steps:

1. LCD Initialization

2. Page Selection

3. Column Selection

4. Data Display

So lets go through each step separately :

Step 1 :- LCD Initialization

Before displaying anything on graphics LCD, it must be initialized, i.e., display must be put on and column/page selection be made. This is achieved by giving proper instructions to the LCD. To make Display On\Off the following set of instructions must be followed in order:

a) Put these values in Data Register

D7

D6

D5

D4

D3

D2

D1

D0

0

0

1

1

1

1

1

D

Data appears when D=1 and disappears when D=0. When the display is off, there is no effect on the data which is stored in DDRAM.

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

c) RS=0, R/W=0 (to select the command mode)

d) EN=1

e) Delay

f) EN=0 (to load data into the input register)

Step 2 :- Page selection

Before writing any data, the page of LCD must be selected. Page can be selected through following steps:

a) Put these values in Data Register

D7

D6

D5

D4

D3

D2

D1

D0

1

0

1

1

1

X3

X2

X1

Since there are a total of 8 pages (0–7), a particular page is selected by setting three bits (X1-X3).

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

c) RS=0, R/W=0 (to select the command mode)

d) EN=1

e) Delay

f) EN=0 (to latch data into the input register)

For example, if X3=0, X2=1 and X1=0, then the second page is selected. Reading or writing operation is done on this page until next page is set. Depending on the column selection, the page is selected from either left or right half of the graphics LCD.

Step 3 :- Column selection

There are 128 column in GLCD and they are automatically incremented. This means that after selecting a column, it increases on its own by one, after each write cycle. So it is easier to write data column by column. A column can be chosen through following instructions:

a) Put these values in Data Register

D7

D6

D5

D4

D3

D2

D1

D0

0

1

Y5

Y4

Y3

Y2

Y2

Y0

The corresponding controller (CS1 or CS2) is selected depending on the Column number as shown below.

chip select GLCD

b) RS=0, R/W=0 (to select the command mode)

c) EN=1

d) Delay

e) EN=0 (to load data into the input register)

For example, if Page address is 0 and Column address is 0, then 0th column of page 0 is selected, i.e., the first column will be selected which is highlighted in the following diagram.

 

Step 4 :- Display data

After page and column selection, data can be sent to LCD for display. The programming steps for display data are as given below:

pAGE ACCESS NEW -

a) Put the data values in Data Register. With every write cycle, data is written in one column and the column then gets auto-incremented. A high data bit (Dx = 1) corresponds to activated (dark) pixel and low data bit (Dx = 0) corresponds to deactivated (light) pixel. Here MSB corresponds to 8th row in column and LSB to 1st row of column.

b) If column < 63 then (CS1=0 & CS2=1) else (CS1=1 & CS2=0)

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

d) EN=1

e) Delay

f) EN=0 (to latch data into the input register)

If data port is given value ‘0x99’ or ‘10011001’ then column takes the values as shown below.

The following points can be included in above programming steps for efficient programming:

1. While sending data to be written with array, one can specify the array limit as well. This limit signifies the number of columns one wants to write at once. If the limit is 8, eight columns will be written at once and if it is 7, seven columns will be written in one go.

2. The condition ‘if (column >127)’ can be used to return the control back to the main function if the limit exceeds the number of columns present in the LCD.

3. The function for setting column should be called again if array limit condition doesn’t fit in left page and has to be extended to right page too.

4. Though column address increases itself by one, but one variable should be taken to check the conditions (2) & (3) explained above.