Using the LCD 12864-06D Display with the Raspberry Pi Pico

The LCD 12864-06D is a graphic (128 by 64 pixels) monochrome Liquid Crystal Display. You will find it in AliExpress and many other stores, but information on it is scarce. An intriguing point is that ads mention that it is graphic and has a Chinese font.

In this post I will present the information I have gathered and share some sample code (using the unofficial RP2040 support for Arduino by  Earle F. Phillhoower III).


Technical Specs

The display area is 58 by 28 millimeters, a nice size. It is available in three different configurations (blue, gray and black background), the one I bought has white pixels on blue background.

The power voltage is 3.3V, but I've seen articles where the display is directly connected to a 5V Arduino (I recommend using level converters or voltage divisors in this case). 


The display has a 13 pin connector. The first 5 pins are the traditional signals (CS, RES, RS, SCK, SI) for a unidirectional SPI connection to a display controller (ST7565R). The next two pins are the power supply (VDD and GND). Next we have 2 pins for the backlight LED  (LEDA e LEDK). The last four pins are for a second SPI interface (SCK, CS, SDO e SDI) that is connected to a ROM chip (16S1Y / ER3805-1).

The ST7565R Display Controller

This controller is similar to other monochrome graphic LCD controllers. Its internal memory stores the display image (up to 132x64). It supports SPI and parallel interfaces, but in this particular display, it is set up to SPI only. The ST7565R has 23 commands, initialization is done by sending many of these commands with values specific to the display and waiting some time between them.


The figure below shows the mapping of the internal memory to the pixels, assuming the display is oriented with the connectoron top:


The Font ROM (16S1Y / ER3805-1)

This memory has 248K and contains fonts for simplified chinese and ASCII:

The memory accepts two commands through the SPI interface:  "Read Data Bytes" (for up to 20MHz operation ) and "Read Data Bytes at Higher Speed" (for up to 30MHz operation). After the command you must send three bytes with the start address (plus one additional dont-care byte if using the "Higher Speed" option). After data you get one memory byte for each byte sent.

This memory is useful for systems with restricted non-volatile memory (not the case for the Pi Pico).

Connecting the Display to the Pi Pico

I used the same SPI channel for the display controller and font ROM. The display and the backlight are powered by the 3.3V output of the Pico. A 220R resistor is used to limit the backlight current.

Some Example Code

The examples I wrote are available at https://github.com/dquadros/LCD12864. At this moment there are three examples:

  • Basic Test initializes the display controller and writes digits on it, using an 8x8 font stored in the program.
  • FontDump exercises communication with the ROM, listing in the Arduino monitor one or more characters in the 7x8 ASCII font. This shows that the font is stored with 8 bytes per character (1 byte for each column, with the last byte always zero). The least significant bit in a byte corresponds to the top pixel.
  • UseRomFont writes a text on the screen using the 7x8 ASCII font in the ROM.


Comments

Popular posts from this blog

Using the PIO to Interface a PS/2 Keyboard