A Circular Reference

Adventures of a vagabond electron.

One Minute Introduction to Graphics TFT LCDs for Embedded Folks

| Comments

Inspired by Jan Axelson’s One minute USB, I have decided to jot down one minute notes for other ridiculously complicated stuff that I deal with every once in a while. First in the series is a TFT LCD note.

  1. A TFT LCD is made up of X x Y number of pixels, each pixel is made up of 3 segments (Red/Green/Blue). The number of bits allocated to R/G/B segments depends on how many bits per pixel (BPP) the display supports. Common formats are 8, 9, 16 and 18 BPP.

  2. Displays can be a bare (RAM-less) glass or it can come with built-in a graphics controller with internal RAM. So the maximum size of display supported by a controller depends on how much RAM it has. For example a controller with 345600 Bytes RAM can support a resolution of 320 x 480 with 18 BPP.

  3. These built-in display controllers generally support a variety of interface “communication” modes. Common formats are 16/8 bit “MCU mode” (also called “System Bus”), which actually means the good old Intel 8080 or Motorolla 6800 parallel bus interface and Serial bus mode(s) (like an SPI using 3 and/or 4 wires). The controller also usually supports a self-abnegating, masochistic mode called RGB mode of operation. In this mode the display controller ceases to exist and allows you to drive the display externally as if it were a bare glass. Which also happens to be what you need to do if your display does not have an controller. You have to provide frame information (HSYNC, VSYNC, Data, CLK..) over the bus. The RGB mode is useful if you are using another external graphics controller (that has more features than the built-in controller) or you want to be flexible to changing the display glass, and perhaps also for lower cost. However, do note that before you enter RGB mode, you need to configure some of the controllers registers with appropriate parameters, and you have to do this using one of the above “communication” modes. The serial modes would be most efficient for this since the data to be transferred is small and need only be sent once on initialization. You can choose which communication mode to use by setting a couple of pins in the display interface high or low.

  4. The color depth of the display depends on the BPP. For instance if you have 18BPP, the color depth is 2 * exp(6+6+6) = 262k colors (assuming 6 bits each for Red, Green and Blue). And if it’s a 1BPP then you can only have 8 colors. 16BPP gives 65k color and this is the most common scheme used, since it can fit nicely into a 16 or 8 bit parallel bus.

  5. The initialization code for a display controller is generally provided by the manufacturer of the display glass and is application/controller specific. However there seem to be some common features across all controllers. For example the addressing of pixels usually have row and column start and end pointers, so in practice it’s not too difficult to write your own init code if you refer some similar controller’s code.

  6. The modus operandi to write a pixel into an arbitrary location in RAM is to a) set Column and Row address pointers (SC,SP) to the (x,y) co-ordinates you want to write the pixel to b) write the 16 bit pixel value to the controller memory Repeat step b) for all the contiguous pixels you want to update. The approach is similar to Read a pixel, only difference being that write control signals are changed to Read signals.

In the next post I will illustrate these concepts with PIC32′s PMP module and two display controllers – ILI9486 and HX8347G.

Comments