How to start with a new LCD without a library?

LCDs have display memory and too many registers. Can someone give a hint or an example how to start programming them. How do you find out what registers to use and how. The picture data goes to the display memory I think. But the picture data format must be specified with the control registers.

I am mainly interested in displaying images in larger LCDs. To me it doesn't matter if it is slow or not, when everything works, there is time for improvements.

Libraries are nice of course, but I would like to do some programming my self. Besides, there are no libraries for every display.

You need the datasheet for the controller and possibly some information specific to your display.

Let us consider the SSD1306 OLED controller. This controller has a lot of registers and is very flexible. In fact it has to be very flexible, because you can wire different kind of OLED screens to it. OLED screens differ a lot:

  • size
  • current for the individual pixel
  • physical layout of the pixel

Most of the registers are there to program the specific characteristics of the OLED screen. This means:

  1. The datasheet of the SSD1306 controller will tell you the register and its purpose. But it can not and will never tell you what values are needed
  2. The datasheet of the OLED itself will tell you the required register values.

Let me give you another example:

You will find the two datasheets on this page: One for the controller and one for the OLED itself.

This is the OLED datasheet from the above page: http://www.buydisplay.com/download/manual/ER-OLED0.66-1_Series_Datasheet.pdf

The register values are a little bit tricky to find, but they are mentioned on page 17 (section 4.4).

Of course some registers of the controller are for programming convenience: Inverse display, screen mirror, etc
Or are just for power down modes, etc.

So finally you have to know both, the datasheet of the controller and the datasheet of the OLED.

Oliver

olikraus:
Let us consider the SSD1306 OLED controller. This controller has a lot of registers and is very flexible.

So finally you have to know both, the datasheet of the controller and the datasheet of the OLED.

That flexibility is the problem. Quite lot of work is required to make a working solution.

Are/is there display manufacturer(s) who give working values for the controller and LCD they use.

Just to name some:

Buydisplay will sell directly, others will have their distribution partners (e.g. www.mouser.com)

You could also takeover init code from exisiting libraries (u8glib/csrc at master · olikraus/u8glib · GitHub)

Although i said, that the init values depend on the actual screen, they are often identical for most displays with the same resolution and controller... of course there are exceptions.

Oiver

I recently went through this exercise for the first time. The manufacturer did not send me any tutorial or example code, only links to both the controller datasheet and some display details: the pinout of the FFC cable and certain key configuration parameters. I spent a fair amount of time reading the controller datasheet, which was partially in a kind of bad version of English. There were some ambiguities. But the information was there, mostly anyway.

jboyton:
I recently went through this exercise for the first time. The manufacturer did not send me any tutorial or example code, only links to both the controller datasheet and some display details: the pinout of the FFC cable and certain key configuration parameters. I spent a fair amount of time reading the controller datasheet, which was partially in a kind of bad version of English. There were some ambiguities. But the information was there, mostly anyway.

All this I would like to avoid.

Thank you olikraus, I will check your links.
"Although i said, that the init values depend on the actual screen, they are often identical for most displays with the same resolution and controller... of course there are exceptions." This is something I would to know, and avoid reinventing the wheel.

You can get started with nothing more than a tft_init() and a tft_putpixel(x, y, color) function.

You can copy the init() from a display vendor. The putpixel() requires you to read the data sheet.

Of course, this solution is not very fast or clever. Read Henning Karlsen's UTFT or Oliver's U8GLIB library code. You will see the common optimisations. Adafruit libraries are generally pretty efficient.

Quite honestly, it is easier to just add your controller to the UTFT library code. For example, a ILI9163. Or the Arduino Zero as a target. Or an 8-bit parallel or hardware SPI interface.

Or you write a low level driver for your controller for the <Adafruit_GFX.h> graphics library.

Starting from scratch is all very well but the whole beauty of C++ is that you can inherit the methods of proven classes.

David.

david_prentice:
You can copy the init() from a display vendor.

The display vendor I purchased from did not provide an init() to copy. Could I have used an init() from some other display vendor?

I looked at the Adafruit library for the same controller, but how could I know if their initialization was correct for my display without understanding the details?

Which controller / display?
ILITECH publish App Notes with initialisation for specific LCD Panels.

If your display looks physically similar to the Adafruit one, you will not go too far wrong by just trying the Adafruit init sequence.

Yes, the details in the data sheet that explain the onboard voltage generators etc are a little difficult to understand. Just compare what Adafruit or ILITECH has done with the data sheet register description(s).

UTFT is incredibly easy to "extend" to different MCU, interface, controller. UTFT is designed for its "universality" rather than speed or efficiency. Once you have got a new display up and running with UTFT, you will have the confidence to use some of the Adafruit "intelligence".

David.

It's not an ILITECH, it's a Sitronix ST7565. I had searched their web site but found very little. The Adafruit values are incorrect for the LCD I have, so I would have had to look at the datasheet anyway if I had tried their settings first. But I couldn't have even hooked up the display to my processor without reading the datasheet. How could I have known what to do with pins labeled V0, V1, CAP1+, CAP2-, RD, WR, C86, VOUT, etc?