Knowledgebase
MS Systems > MS Systems Help Desk > Knowledgebase

Search help:


ST7920 Graphical LCD SPI Wiring

Solution

 

Using a Generic ST7920 128x64 Graphical LCD in SPI mode

Some very reasonably priced 128x64 graphical LCDs have been popping up on e-bay recently.  The controller chip used in these panels is an ST7920, which supports both parallel and serial (SPI) communication modes.  SPI offers simplified hardware connection, using only three data wires, and is particularly attractive for interfacing to MCUs with a limited number of digital output pins.

SPI mode is selected by driving the PSB pin (15) low.  However, some panels are shipping with PSB hard wired to VSS (+5V).  In this case, tieing PSB to ground (0V) or attempting to drive PSB low with an MCU pin, will create a direct short, quite possibly damaging the device supplying power to the LCD.

WARNING

Before attempting to use the LCD in SPI mode, the resistance between PSB and VSS should be checked, using an Ohmeter (multimeter) connected between Pin 15 and Pin 1 of the LCD circuit board.  A continuity buzzer, is adequate for the job.  A resistance < 5K indicates that PSB is wired to ground and the circuit board will need attention before use.

 

Breaking the PSB Connection to +5V

On the back of the LCD circuit board are a number of SMT components.  In the bottom right of the PCB there is a group of components, arranged in parallel and labelled top to bottom, R8, C5, R9, R10.  R10 may be absent.  Buzzing out R9 should show it is connected to both PSB and VSS and has a resitance of 0 Ohms (a link).

To break the connection between PSB and VSS, use a soldering iron to carefull remove the R9 link.

The resistance between PSB and VSS should be checked again and if it is >5K, it should be safe to wire PSB to ground.

 

LCD SPI Wiring

Arduino to LCD pin mapping

 0V LCD1 VDD 

 5V LCD2 VSS

 D10 LCD4 RS

 D11 LCD5 RW

 D13 LCD6 E

 0V LCD15 PSB //mode select.  Low = SPI, High = Parallel

 5V LCD19 BLA

 

 0V LCD20 BLK

 

Library and Initialisation

The U8GLib project provides a library which is compatibly with the ST7920 and many other LCD controllers.

https://code.google.com/p/u8glib/

The library provides a confusing array of constructors, covering the many different permutations of hardware and communication modes.  

For a generic 128 x 64 LCD, with ST7920 controller, SPI mode, use...

U8GLIB_ST7920_128X64_4X u8g(Enable, RW, RS);

For example...

 

U8GLIB_ST7920_128X64_4X u8g(13, 11, 10);

 

 
Was this article helpful? yes / no
Article details
Article ID: 56
Category: Embedded
Date added: 28-02-2014 09:00:41
Views: 9959
Rating (Votes): Article rated 4.1/5.0 (39)

 
« Go back

 
Powered by Help Desk Software HESK, brought to you by SysAid