GLCD Overview

The GLCD commands are used to control a Graphical Liquid Crystal Display (GLCD) based on the a number of GLCD chipsets. These are often 128x64 pixel displays but the size can vary. GLCD devices draw graphical elements by enabling or disabling pixels.

A GLCD is an upgrade from the popular 16x2 LCDs (see Liquid Crystal Display Overview ) but the GLCD allows full graphical control of the display.

Typical displays are

  • Color or mono displays
  • Low power white LED, OLED with or without back-light
  • e-Paper with low power consumption
  • Driven by on-board interface chipsets amd/or interface controllers
  • The GLCDs are very common and well documented
  • Small to large view areas
  • Typically requires from 3-pin to 36-pin header connections and 10K contrast pot
  • Typically have back-lit pixels
  • Require memory in the microcontroller to support graphial operations or can be used in text and picture mode

GCBASIC makes this type of device easier to control with the commands for the GLCD.

Microcontroller Requirements: Specific GLCDs require different configurations of a microcontroller. Parameters include

  • Communications protocol: These incldue 8 wire bus, I2C, SPI etc
  • Operating votlage: These are typically 3.3v or 5.v
  • Memory required: For full GLCD capabilites you will require 1k or more, for text only and JPG mode low memory devices are supported

Review your choice of microcontroller and GLCD carefully before commencing your project.

# ChipSet Size Pixels Depth Type I/O Support Operating Comments Requirements Assessment

1

KS0108

2.9 inch and less. various sizes

128 * 64

Large

Mono

LCD typically with backlight

8-bit parallel PIC and AVR: Software device specific protocol

Typically operates at VCC 5. Always check voltage specifications 8-bit bus required.

Bit 7 of the bus is read/write – this could cause potential lockup – this is low risk.   Uses the KS0107B (or NT7107C) a 64-channel common driver which generates the timing signal to control the two KS0108B segment drivers.

Requires 12 ports/connections.

These are low cost mono devices.

2

ILI9481

3.2inch

320 * 240

Large

Color

TFT LCD 8-bit parallel

PIC: Set per bit. AVR: via Shield set via AND PORT command

+VCC from 2.7 to 5. Always check voltage specifications

UNO shield is excellent. Very fast display.

SPI requires 4 ports plus 2 ports. Typically 6 in total.

Good GLCD with very good GLCD performance.

3

PCD8544

1.77inch

Nokia 3310 or 5110

160 * 128

Small Mono LCD with LED

SPI

PIC and AVR: Device specific SPI command, all in software.

Display can operate in text mode only for low RAM microcontrollers as full GLCD capabilities requires 512bytes of RAM. +VCC 3.3. Always check voltage specifications Nice display. Sensitive to operating voltages.

Minimum RAM required is 512 bytes then add user variables for graphics mode, this display can operate in text mode only for low RAM microcontrollers.

SPI requires 4 ports plus 2 ports. Typically 6 in total.

Good for cost and performance

4

ILI9341

2.8 Inch or 3.2 Inch

320 * 240

Medium

Color TFT

SPI PIC and AVR: Hardware and software SPI

Typically operates at VCC 5. Always check voltage specifications

+VCC from 2.7 to 5. Always check voltage specifications

Very nice display.

SPI requires 4 ports plus 2 ports. Typically 6 in total.

Good for cost and performance

5

SSD1289

3.2inch

240 * 320

Large

Color

TFT LCD

16-bit parallel AVR: Software device specific protocol.

Typically operates at VCC 5. Always check voltage specifications

Mega2560 shield required.

Connectivity requires 20 ports.

Good for Mega2560 type shields

6

ST7735

1.8 Inch

128 * 64

Large

Color

TFT LCD

SPI

PIC and AVR: Hardware and software SPI

Typically operates at VCC 5. Always check voltage specifications Very nice display.

SPI requires 4 ports plus 2 ports. Typically 6 in total.

Good for cost and performance

7

ST7735R

1.8 Inch

128 * 160

Large

Color

TFT LCD

SPI

PIC and AVR: Hardware and software SPI

Typically operates at VCC 5. Always check voltage specifications Very nice display.

SPI requires 4 ports plus 2 ports. Typically 6 in total.

Good for cost and performance

8

ST7735R_160_80

1.8 Inch

160 * 80

Large

Color

TFT LCD

SPI

PIC and AVR: Hardware and software SPI

Typically operates at VCC 5. Always check voltage specifications Very nice display.

SPI requires 4 ports plus 2 ports. Typically 6 in total.

Good for cost and performance

9

ILI9340

2.2 Inch

240 * 320

Medium

Mono

TFT LCD

SPI

PIC and AVR: Hardware and software SPI

Typically operates at VCC 5. Always check voltage specifications

SPI requires 4 ports plus 2 ports. Typically 6 in total.

Good for cost and performance

10

ILI9486L or ILI9486

4inch

RPI 240 * 320

Large

Color

TFT LCD

SPI and 8Bit Bus

PIC and AVR: Hardware and software SPI AVR: 8Bit Bus using an UNO Shield. PIC: 8bit port suppported.

Typically operates at VCC 5. Always check voltage specifications Great pixel display.

SPI requires 4 ports plus 2 ports. Typically 6 in total. 8Bit Bus requires 8 ports plus 4 control ports. Typically 13 in total using an 8bit bus solution.

An expensive option

11

Nexion

ITEAD Nexion

240 * 320 to 800 * 480

Large - 2.4 to 7inches

Color

TFT LCD

Serial - hardware or software serial is supported.

Nextion specfic and GLCD command set

Typically operates at VCC 5 with external power supply. Always check voltage specifications Great command set, you need to learn the GUI and then interface to GCBASIC.

2 ports for the read/write serial operations.

A very nice option but if you need flexibility then the best!

12

SH1106

1.3 inch or 0.96inch

128 * 64

Small

Mono OLED

I2C

PIC and AVR: Hardware and software I2C

Always at 3.3v. Always check voltage specifications

RAM for Full Mode GLCD is 1024 bytes or Low Memory GLCD is 128 bytes or 0 bytes for Text GLCD Mode then add user variables for graphics mode.

I2C requires 2 ports.

Good OLED display, excellent value for money

13

SDD1306

0.96inch

128 * 64

Small

Mono

OLED

I2C and SPI

PIC and AVR: Hardware and software I2C, and software SPI

RAM for Full Mode GLCD is 1024 bytes or Low Memory GLCD is 128 bytes or 0 bytes for Text GLCD Mode then add user variables for graphics mode. Typically operates at VCC 5. Always check voltage specifications Very good OLED display. Driver supports gaming. Minimum RAM required is 1024 bytes then add user variables for graphics mode.

Display can operate in text mode only for low RAM microcontrollers

SPI requires 4 ports plus 2 ports. Typically 6 in total.

I2C requires 2 ports.

Good OLED display, excellent value for money

14

SDD1306 Twin Screen

0.96inch * 2

128 * 128

Small

Mono

OLED

I2C and SPI

PIC and AVR: Hardware and software I2C, and software SPI

RAM for Full Mode GLCD is 2048 bytes or Low Memory GLCD is 128 bytes or 0 bytes for Text GLCD Mode then add user variables for graphics mode. Typically operates at VCC 5. Always check voltage specifications Very good OLED display. Driver supports gaming. Minimum RAM required is 1024 bytes then add user variables for graphics mode.

Display can operate in text mode only for low RAM microcontrollers

SPI requires 4 ports plus 3 ports. Typically 7 in total.

I2C requires 2 ports.

Good OLED display, excellent value for money

15

SDD1306_32

0.96inch

128 * 32

Very small

Mono

OLED

I2C and SPI

PIC and AVR: Hardware and software I2C, and software SPI

RAM for Full Mode GLCD is 512 bytes or Low Memory GLCD is 128 bytes or 0 bytes for Text GLCD Mode then add user variables for graphics mode. Typically operates at VCC 5. Always check voltage specifications Best small OLED display. Driver supports gaming. Minimum RAM required is 512 bytes then add user variables for graphics mode, this display can operate in text mode only for low RAM microcontrollers

SPI requires 4 ports plus 2 ports. Typically 6 in total.

I2C requires 2 ports.

Good OLED display, excellent value for money

16

ST7920

2.9inch

128 * 64

Large

Mono

LCD typically with backlight 8-bit parallel

PIC and AVR: Software device specific protocol.

Typically operates at VCC 5. Always check voltage specifications

8-bit bus required. Bit 7 of the bus is read/write – this could cause potential lockup – this is low risk.

This looks like a KS0108 but it is NOT! Supports Chinese font set.

Requires 12 ports.

A very slow device.

17

HX8347G

2.2inch

240 * 320

Large

Color

TFT LCD

SPI

AVR 8 bit bus

Typically operates at VCC 5. Always check voltage specifications Great pixel display.

Controller requires 8 ports plus 5 control ports. Typically 13 in total with an UNO shield.

An very nice display

18

SDD1331

0.96inch

96 * 48

Small

Color

OLED

SPI

PIC and AVR: Hardware and software I2C, and software SPI

Typically operates at VCC 5. Always check voltage specifications

SPI requires typically 6 in total.

Very good color OLED display, excellent value for money

19

ILI9326

3.00inch

400 * 320

Large

Color

OLED

8 bit bus

PIC and AVR: 8 bit bus

Typically operates at VCC 3.3. Always check voltage specifications

Requires typically 13 in total plus 0v, VCC and LED.

Good color OLED display, good value for money as it is fast. But, the rotate is all executed in software and this does slow down processing.


The LED connected is typically to ground. You can solder the GND connect to make the backlite permanently on.

20

NT7108C

2.9 inch and less. various sizes

128 * 64

Large

Mono

LCD typically with backlight

8-bit parallel PIC and AVR: Software device specific protocol

Typically operates at VCC 5. Always check voltage specifications 8-bit bus required.

Look similar to KS0108, but, it is NOT the same, hence this driver.   Uses the Winstar’s WDG0151-TMI module, which is a 128×64 pixel monochromatic display.   This uses two Neotic display controller chips: NT7108C and NT7107C. The WDG0151 module contains two sets of it to drive 128 segments.   On the other hand, the KS0107B (or NT7107C) is a 64-channel common driver which generates the timing signal to control the two KS0108B segment drivers.

The NT7108C is very sensitive with respect to clock timing.   You may have to adjust to ensure the display operates as correctly.

Requires 12 ports/connections.

These are medium cost mono devices.

21

T6963_64

4inches by 2inches

240 * 64

Large

Mono

LCD typically with backlight

8-bit parallel PIC and AVR: Software device specific protocol

Typically operates at VCC 5. Always check voltage specifications 8-bit bus required.

Operating similar to KS0108 and an LCD. segment drivers.

Requires 12 ports/connections.

These are medium cost mono devices.

22

T6963_128

4inches by 2inches

240 * 128

Large

Mono

LCD typically with backlight

8-bit parallel PIC and AVR: Software device specific protocol

Typically operates at VCC 5. Always check voltage specifications 8-bit bus required.

Operating similar to KS0108 and an LCD. segment drivers.

Requires 12 ports/connections.

These are medium cost mono devices.

23

UC1601

4.00inch

132 * 22

Medium

Mono

OLED

I2C and SPI

PIC and AVR: Hardware and software I2C, and software SPI

RAM for Full Mode GLCD is 396 bytes or Low Memory GLCD is 128 bytes or 0 bytes for Text GLCD Mode then add user variables for graphics mode. Typically operates at VCC 2.8v. Always check voltage specifications Very good display. Driver supports gaming. Minimum RAM required is 396 bytes then add user variables for graphics mode.

Requires up to 5 ports/connections.

Low cost device

24

SDD1351

1.50inch

128 * 128

Small

Color

OLED

SPI

PIC and AVR: Hardware and software I2C, and software SPI

Typically operates at VCC 3.3 or 5. Always check voltage specifications

SPI requires typically 6 in total.

Very good color OLED display, excellent value for money

25

Waveshare e-Paper

Various Size from 2.13 to 7.5 inches

104 * 112 to 640 * 384

Small to very large

Black and White

Microencapsulated Electrophoretic Display

SPI

PIC and AVR: Hardware and software I2C, and software SPI

Typically operates at VCC 3.3. Always check voltage specifications

SPI requires typically 6 in total.

Very good color e-Paper displays, excellent value for money Display can operate in text mode only for low RAM microcontrollers using SRAM solution.

26

ST7789

2.0 Inch

240 * 240 or 320 * 240

Medium

Color TFT

SPI PIC and AVR: Hardware and software SPI

Typically operates at 3v3. Always check voltage specifications

+VCC from 3v3. Always check voltage specifications

Very nice display.

SPI requires 3 ports (data, clock & command/data) plus 1 port ( reset ). Typically 4 in total.

Good for cost and performance

27

ST7735R_160_80

1.8 Inch

160 * 80

Large

Color

TFT LCD

SPI

PIC and AVR: Hardware and software SPI

Typically operates only at VCC 3.3. Always check voltage specifications Very nice display.

SPI requires 4 ports plus 2 ports. Typically 6 in total.

Good for cost and performance

28

ILI9488

3.2inch

320 * 240

Large

Color

TFT LCD SPI

PIC/&AVR: SPI Only

+VCC from 3v3 to 5. GLCD I/O is ONLY 3v3. Always check voltage specifications.

Display is good, however, slower than comparable (size) GLCDs as the color definitions are four bytes ( typical color definitions are two bytes)

SPI requires 4 ports plus 2 ports. Typically 6 in total.

Acceptable GLCD performance.

29

ST7567

1.9inch

128 * 64

Medium

Mono

LCD

I2C and SPI

PIC and AVR: Software I2C, and, hardware software SPI. Harware IC2 fails as the ST7567 does not comply witht the I2C standard.

+VCC from 3v3 to 5. GLCD I/O is ONLY 3v3. Always check voltage specifications.

SPI requires 4 ports plus 2 ports. Typically 6 in total.

I2C requires 2 ports.

Typically operates at VCC 3v3 but may support 5v0. Always check voltage specifications Very good LCD display. Driver supports gaming. Minimum RAM required is 1024 bytes then add user variables for graphics mode.

Setup:

You must include the glcd.h file at the top of your program. The file needs to be in brackets as shown below.

    #include <GLCD.h>

Defines:

There are several connections that must be defined to use the GLCD commands with a GLCD display. The I/O pin is the pin on the Microchip PIC or the Atmel AVR microcontroller that is connected to that specific pin on the graphical LCD.

Example: KS0108 connectivity

    #define GLCD_RW   _I/O pin_ ‘Read/Write pin connection
    #define GLCD_RESET  _I/O pin_ ‘Reset pin connection
    #define GLCD_CS1  _I/O pin_ ‘CS1 pin connection
    #define GLCD_CS2  _I/O pin_ ‘CS2 pin connection
    #define GLCD_RS   _I/O pin_ ‘RS pin connection
    #define GLCD_ENABLE _I/O pin_ ‘Enable pin Connection
    #define GLCD_DB0  _I/O pin_ ‘Data pin 0 Connection
    #define GLCD_DB1  _I/O pin_ ‘Data pin 1 Connection
    #define GLCD_DB2  _I/O pin_ ‘Data pin 2 Connection
    #define GLCD_DB3  _I/O pin_ ‘Data pin 3 Connection
    #define GLCD_DB4  _I/O pin_ ‘Data pin 4 Connection
    #define GLCD_DB5  _I/O pin_ ‘Data pin 5 Connection
    #define GLCD_DB6  _I/O pin_ ‘Data pin 6 Connection
    #define GLCD_DB7  _I/O pin_ ‘Data pin 7 Connection
    #define GLCD_PROTECTOVERRUN 'prevent screen overdrawing     'SSD1306 GLCD only
    #define GLCDDirection       'Invert GLCD Y axis             'KS0108 GCD only

Common commands supported across the range of supported GLCDs are:

Command Purpose Example

GLCDCLS

Clear screen of GLCD

GLCDCLS

GLCDPrint

Print string of characters on GLCD using GCB font set

GLCDPrint( Xposition, Yposition, Stringvariable )

GLCDDrawChar

Print character on GLCD using GCB font set

GLCDDrawChar( Xposition, Yposition, CharCode )

GLCDDrawString

Print characters on GLCD using GCB font set

GLCDDrawString( Xposition, Yposition, Stringvariable )

Box

Draw a box on the GLCD to a specific size

Box ( Xposition1, Yposition1, Xposition2, Yposition2, [Optional In LineColour as 0 or 1] )

FilledBox

Draw a box on the GLCD to a specific size that is filled with the foreground colour.

FilledBox (Xposition1, Yposition1, Xposition2, Yposition2, [Optional In LineColour 0 or 1] )

Line

Draw a line on the GLCD to a specific length that is filled with the specific attribute.

Line ( Xposition1, Yposition1, Xposition2, Yposition2, [Optional In LineColour 0 or 1] )

PSet

Set a pixel on the GLCD at a specific position that is set with the specific attribute.

PSet(Xposition, Yposition, Pixel Colour 0 or 1)



Public variable supported across the range of supported GLCDs are shown in the table below. These variables control the user definable parameters of a specific GLCD.

Variable Purpose Type

GLCDBackground

Color of GLCD background.

Can be monochrome or color.
For mono GLCDs the default is White or 0x0001. For color GLCDs the default is White or 0xFFFF.

GLCDForeground

Color of GLCD foreground.

Can be monochrome or color.
For mono GLCDs the default is non-white or 0x0000. For color GLCDs the default is Black or 0x0000.

GLCDFontWidth

Width of the current GLCD font.

Default is 6 pixels.

GLCDfntDefault

Size of the current GLCD font.

Default is 0.+ This equates to the standard GCB font set.

GLCDfntDefaultsize

Size of the current GLCD font.

Default is 1.+ This equates to the 8 pixel high.

For color TFT displays any color can be defined using a valid hexidecimal word value between 0x0000 to 0xFFFF., see http://www.barth-dev.de/online/rgb565-color-picker/ for a wider range of color parameters.

The following color constants are prevent-defined.

    TFT_BLACK       0x0000
    TFT_NAVY        0x000F
    TFT_DARKGREEN   0x03E0
    TFT_DARKCYAN    0x03EF
    TFT_MAROON      0x7800
    TFT_PURPLE      0x780F
    TFT_OLIVE       0x7BE0
    TFT_LIGHTGREY   0xC618
    TFT_DARKGREY    0x7BEF
    TFT_BLUE        0x001F
    TFT_GREEN       0x07E0
    TFT_CYAN        0x07FF
    TFT_RED         0xF800
    TFT_MAGENTA     0xF81F
    TFT_YELLOW      0xFFE0
    TFT_WHITE       0xFFFF
    TFT_ORANGE      0xFD20
    TFT_GREENYELLOW 0xAFE5
    TFT_PINK        0xF81F

This example shows how to drive a KS0108 based Graphic LCD module with the built in commands of GCBASIC. See Graphic LCD for details, this is an external web site.

Example:

    ;Chip Settings
    #chip 16F886,16
    '#config MCLRE = on 'enable reset switch on CHIPINO
    #include <GLCD.h>

    ;Defines (Constants)
    #define GLCD_RW PORTB.1  'D9 to pin 5 of LCD
    #define GLCD_RESET PORTB.5 'D13 to pin 17 of LCD
    #define GLCD_CS1 PORTB.3 'D12 to actually since CS1, CS2 can be inverted
    #define GLCD_CS2 PORTB.4 'D11 to actually since CS1, CS2 can be inverted
    #define GLCD_RS PORTB.0  'D8 to pin 4 D/I pin on LCD
    #define GLCD_ENABLE PORTB.2 'D10 to Pin 6 on LCD
    #define GLCD_DB0 PORTC.7 'D0 to pin 7 on LCD
    #define GLCD_DB1 PORTC.6 'D1 to pin 8 on LCD
    #define GLCD_DB2 PORTC.5 'D2 to pin 9 on LCD
    #define GLCD_DB3 PORTC.4 'D3 to pin 10 on LCD
    #define GLCD_DB4 PORTC.3 'D4 to pin 11 on LCD
    #define GLCD_DB5 PORTC.2 'D5 to pin 12 on LCD
    #define GLCD_DB6 PORTC.1 'D6 to pin 13 on LCD
    #define GLCD_DB7 PORTC.0 'D7 to pin 14 on LCD

    Start:
    GLCDCLS
    GLCDPrint 0,10,"Hello"        'Print Hello
    wait 5 s
    GLCDPrint 0,10, "ASCII #:"    'Print ASCII #:
    Box 18,30,28,40               'Draw Box Around ASCII Character
    for char = 15 to 129          'Print 0 through 9
      GLCDPrint 17, 20 , Str(char)+"  "
      GLCDdrawCHAR 20,30, char
      wait 125 ms
    next
    line 0,50,127,50               'Draw Line using line command
    for xvar = 0 to 80             'Draw line using Pset command
        pset xvar,63,on                    '
    next                                        '
    Wait 1 s
    GLCDPrint 0,10,"End  "          'Print Hello
    wait 1 s
    Goto Start

For more help, see Graphical LCD Demonstration, GLCDCLS, GLCDDrawChar, GLCDPrint, GLCDReadByte, GLCDWriteByte, Pset