12864 Graphics LCD Wiring

I am trying to hook up an 12864 LCD display with an SPT LCD Module on the back to my Arduino MegaADK, and I’m going by the post on the playground: http://playground.arduino.cc/Code/LCD12864
The post says I need to connect CSEL1 to Arduino Pin 14. I do not see a CSEL1 pin on the LCD Module, but there is a CS. Are they equivalent?
The post also says I “…need to connect a POT with 5V on one side, ground on the other, and 5V (perhaps with 150 Ohm resistance) + LCD Pin 19 to the wiper…” I do not have any LCD Pin 19 on the LCD Module. Is there another pin name for Pin 19?
Thanks for any help.

Does your module have a pin labelled PSB? If so, it is probably based on the ST7920 chip, in which case it needs a different driver (e.g. u8glib, or my own more basic driver) and different connections from the usual sort. The good news is that you can drive these using just 2 Arduino pins.

Thank you for the reply.
There is no pin labelled “PSB.” The only pins labelled with letters (nominally) on the 2x7 pin configuration are: E, RW, RS, VCC, and GND. To the left of this configuration is “BL” and to the right is “4-8 BUS.” The 3x2 configuration on the right side of the LCD Module has nominal pins: SCK, CS, SID, GND, and VCC. Under the contrast shiftout there is a “1” labelled just above the same pin as SCK. I don’t know if that refers to the bottom pin in the middle or not.
However, there is a toggle switch to the left side of the module that says “PSB_On” with one side of the switch labelled “SPI” and another “LPT.”
There is nothing labelled here to give me a model number that can help me find a datasheet. I will try playing with the u8glib. Thanks again for your help.


It sounds to me like a ST7920-based display with that daughterboard added. The PSB switch selects between the serial interface (CS, SCK and SID pins) and the parallel interface (the 4-8 BUS pins). You need to choose one of them. Serial is easiest because it uses fewer wires.

datasheet seems to be here: http://www.icstation.com/ebay/IC/All%20data%20modules/1445.zip

Thank you both for your help. Between the two of you I was able to make some headway, but once again I'm stuck. I downloaded the library from: https://bitbucket.org/jasonweiyi/robots/overview and used the code and wiring from the first example on this page: http://www.dfrobot.com/wiki/index.php/3-wire_Serial_LCD_Module_%28Arduino_Compatible%29_%28SKU:DFR0091%29 . When I would try to upload the program it would give me a number of errors that would say: "sketch_may16c:44: error: 'class LCD12864RSPI' has no member named... (insert member name)." I checked the library and noticed the cases were different, and so I went through the program and changed the cases to match those in the library. My program successfully uploaded with no errors, but I'm not getting any results on my screen. It lights up but shows no animation. I have the PSB set to SPI, so I don't believe that's where my error is coming from. I have posted my edited code from the website below:

#include "LCD12864RSPI.h"
#define AR_SIZE( a ) sizeof( a ) / sizeof( a[0] )

unsigned char show0[]={0xBB,0xFA,0xC6,0xF7,0xC8,0xCB,0xC3,0xCE,0xB9,0xA4,0xB3,0xA7};//DFRobot
unsigned char show1[]="www.dfrobot.com";//
void setup()
LCDA.initialise(); // INIT SCREEN

void loop()
LCDA.clear();//Clear the screen
LCDA.displaySig(0,0,0x20);//Display space

The library is as follows:

class LCD12864RSPI {
    typedef unsigned char uchar;


    void initialise(void);         /* Initialize the screen. */
    void delayns(void);            /* Delay dalayTime amount of microseconds. */

    void writeByte(int data);      /* Write byte data. */
    void writeCommand(int cmd);    /* Write command cmd into the screen. */
    void writeData(int data);      /* Write data data into the screen. */
    void moveCursor(int X, int Y); /* Move cursor to 0-based column X and 0-based row Y as the starting point of the next display. */

    void clear(void);                               /* Clear the screen. */
    void clearRow(int Y);                           /* Clear the y-th row (y is 0-based) */
    void fillBlock(int X, int Y, uchar c, int len); /* Fill block starting from 0-based column X and 0-based row Y with the character c. The filled block is of length len.*/
    void clearBlock(int X, int Y, int length);      /* Clear the block starting from 0-based column X and 0-based row Y. The cleared block is of len byte long. */

    void printf(int X, int Y, char *fmt, ... );         /* Display formated string at 0-based column X and 0-based row Y. The formatted string should not be longer than 64 characters. */
    void displayString(int X,int Y,uchar *ptr,int dat); /* Display string ptr (with length len) at 0-based column X and 0-based row Y. */
    void displaySig(int M,int N,int sig);               /* Display a single character sig at 0-based column X and 0-based row Y. */
    void displayInteger(int X, int Y, int number);      /* Display integer number at 0-based column X and 0-based row Y. */

    void drawFullScreen(uchar *p);  /* Display the full screen using data from p. */
    void drawImage1(uchar img[]);   /* Display image */
    void drawImage2(uchar img[]);   /* Display image */

    int delayTime;    /* Delay time in microseconds. */
    int DEFAULTTIME;  /* Default delay time. */

    static const int latchPin = 8; 
    static const int clockPin = 3;  
    static const int dataPin  = 9;

Thanks ahead of time.

I don't know anything about that library, but because of the mention of "latchPin" at the end of the code, I suspect that it is for driving a different sort of display (maybe a parallel-mode display through a shift register). I suggest you use u8glib instead, or alternatively my more limited library for ST7920-based displays which you can find at https://github.com/dc42/arduino.

The lib seems to fit to the display. Will the original example also show such an error: spi_text_example.ino

BTW the latchPin seems to be the chip select pin.

But as dc42 mentioned... it is difficult to comment other peoples libs...


Thank you both for your help. I used the u8glib and my screen is finally working. I look forward to trying out your library as well dc42. Again, thank you both.

Anyone have an updated link to the spec sheet for this LCD module? Thanks!

3-wire Serial LCD Module (Arduino Compatible) http://www.dfrobot.com/index.php?route=product/product&filter_name=DFR0091&product_id=372#.V1tx-5F96hd

ST7920 LCD http://www.hpinfotech.ro/ST7920.pdf