Graphical LCD 128x64 Display Guide with Arduino Programming

Introduction

Graphical LCD has 128x64 pixels. It has 128 columns and 64 row segments.

GLCD 128x64

 

  • It uses two display segment drivers. Since segment driver has 64 channel, GLCD module contains two segment drivers to drive 128 column segments.
  • It has one common driver which drives 64 row segments as well as it generates clock and control signals for two segment drivers as shown in figure below.
This Picture shows GLCD Internal Block Diagram
Block Diagram of GLCD

 

GLCD 128x64 Pin Diagram

GLCD module JHD12864E has 20 pins as shown in below figure.

This picture shows Pin Diagram of GLCD 128x64
Pin Diagram of GLCD 128x64

 

Since it has two segment drivers to drive 128 column segments, GLCD splits into two parts i.e. Left side and Right side. It has 20 pins. Following table will show pin description with their functions.

Pin No.SymbolDescriptionFunction
1VSSGround0V
2VDDPower Supply for Logic Circuit+5V
3VO

LCD Contrast

Adjustment

Contrast Control
4RS

Instruction/Data

Register Selection

RS = 0: Instruction Register

RS = 1:  Data Register

5R/WRead/Write Selection

R/W = 0: Write

R/W = 0: Read

6EEnable Signal 
7 – 14DB0–DB7Data Input/output Lines8 – Bit
15CS1Chip (Seg. Driver) SelectionCS1 = 1: Select Chip1
16CS2Chip (Seg. Driver) SelectionCS2 = 1: Select Chip2
17RSTReset Signal

RST = 0: Display OFF,

Display from Line 0

18VEENegative Voltage for LCD Driving-10 V
19LED+Supply Voltage for Led++5V
20LED-Supply Voltage for Led-0V

 

Writing to GLCD 128x64

Let’s see how to write to Graphical LCD. It needs to know where data gets displayed on GLCD. Figure given shows where and how D0-D7 data will be seen on display.

This picture shows GLCD 128x64 Display Format

Above figure shows X (Row) and Y (Column) address to select location for data write. Two controllers control each half of display. Each half of display has vertical 64 pixels’ addresses which are accessed by Y address from 0x40 to 0x7F. These two controllers alternatively selected by CS1 and CS2 pins to select either half of display for write,

-  To select left half of display we need to make CS1 = 1, CS2 = 0.

-  To select right half of display we need to make CS1 = 0, CS2 = 1.

X address is shown in above figure as page 0 – 7. Each page contains 8 rows.

 

Display Data on GLCD

To display data on LCD we need to write it on LCD data pins. After providing proper address we can send data to GLCD. Data value is directly mapped by pixels to glow. Accordingly, we need to send data.

This is the picture of GLCD128x64 Display Format 2

 

Above figure shows data print on GLCD for which,

-  We need to set Y address from where we need to write i.e. here it is from first location, so address is 0x40.

-  Then we need to set X address to first page i.e. 0xB8.

-  And write data as shown in above figure to data pins. It will print as in figure.

 

Instructions for JHD12864E GLCD

No.InstructionRSR/WDB7DB6DB5DB4DB3DB2DB1DB0Function
1Display ON/OFF0000111110/1

Controls Display ON/OFF

0=OFF 1=ON

2Set Y Address0001Y address (0 - 63)Sets the Y Address
3Set Page (X Address)0010111Page (0 - 7)Sets X Address
4Set Display Start Line (Z Address)0011Display Start Line (0 - 63)Sets Display Start Line
5Status Read01Busy0ON/OFFReset0000

Read Status

Busy:

0=Ready

1=Busy

ON/OFF:

0=Display ON

1=Display OFF

Reset:

0=Normal

1=Reset

6Write Display Data10Write DataWrites data into display data RAM. After writing instruction, Y Address incremented by 1 automatically
7Read Display Data11Read DataReads data from display data RAM to data bus

 

Display ON/OFF

Display data control instruction controls Display ON/OFF function. It is used to display data in RAM on Screen. It is controlled by DB0 bit as shown in above table.

            1 = Display data on screen.

            0 = Not display data on screen.

Set Y Address

Y Address of display data RAM is set in Y Address counter. Whenever write/read operation is executed, Y Address counter gets automatically incremented by one.

Set X Address (Page)

X Address (page) of display data RAM needs to be set in X Address Register. Here, user needs to increment page through program after every Y Address overflow occurs on current page. Note that if X Address (page) is not incremented after Y Address overflow occurs, then overwrite will occur on current page.

Set Display Start Line (Z Address)

Z Address of display data RAM is set in Display Start Line Register. It is used to set row (0 - 63) line from where data will be displayed on screen. Usually it sets to 0 i.e. data will be displayed from 0th (first line) top start line.

Status Read

This instruction is used to read status of GLCD.

Busy: Busy Status

            1 = Device is busy in executing internal operation. No instruction will be accepted.

            0 = Device is ready to accept instruction.

ON/OFF: Display ON/OFF Status

            1 = Display ON

            0 = Display OFF

Reset: Reset Status

1 = Shows system is being initialized. No instruction will be accepted except Status Read instruction.

            0 = System is in usual operation condition.

Write Display Data

This instruction writes 8-bit data into display data RAM.

Read Display Data

This instruction reads 8-bit data from display data RAM.

 

GLCD Considerations

As there are different types of GLCD modules available in market,

-  It is important to check the datasheet for GLCD modules.

-  Each has different pin configuration and specifications.

-  Incorrect connections are the most common cause for problems.

-  Care should be taken for power pins as incorrect wiring can damage module.

-  Check instructions timing values from datasheet.

 

Initialization

To initialize the display, we need to do steps given below,

-  Send Display OFF command i.e. 0x3E

-  Send Y address e.g. here 0x40 (Start address).

-  Send X address (Page) e.g. here 0xB8 (Page0).

-  Send Z address (Start line) e.g. here 0xC0 (from 0th line).

-  Now send Display ON command i.e. 0x3F

 

Command Write

To write command, we need to do steps given below,

-  Send command on data pins.

-  Make RS = 0 (Command Register) and RW = 0 (Write Operation).

-  Make High to Low transition on Enable pin of minimum 1 us period.

 

Data Write

To write data, we need to do steps given below,

-  Send Data on data pins.

-  Make RS = 1 (Data Register) and RW = 0 (Write Operation).

-  Make High to Low transition on Enable pin of minimum 1us period.

 

Displaying Image

Let’s see how to display image on GLCD. We can display binary image up to 128x64 pixel resolution. Binary image means each pixel has only two values i.e. 0 or 1. So here in GLCD 128x64, either that pixel will be ON or OFF.

-  First, we need to know that GLCD 128x64 JHD12864E can display only Binary image.

-  So, we need to convert image into binary format to display it on GLCD.

-  There are several ways to do this, we will use Image2GLCD application.

Image2GLCD application converts JPG, GIF, BMP, PNG format image files to binary format.

-  This application creates binary data to represent image on GLCD.

-  As shown in below snap of application, click on Open to select image from drive and Save data.

Image2GLCD Window

-  And now you have saved binary image data to print on GLCD. Simply write it to GLCD and see your image on GLCD.

You can download Image2GLCD application from below attachments.

Output Displayed On GLCD 128x64

Programming and interfacing of GLCD with 8 bit Controllers with example is given below.

Examples of GLCD 128x64 interfacing

  1. GLCD 128x64 Interfacing with PIC18F4550
  2. GLCD 128x64 Interfacing with ATmega16
  3. GLCD 128x64 Interfacing with 8051

Components Used

GLCD 128x64
GLCD 128x64 is a Graphical LCD having 128x64 pixel resolution. It is used to display values, text with different fonts, binary images, animation, custom character.
1

Downloads

Image2GLCD application Download
Ad