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.
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:
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
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.
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.
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_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".
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?