LCD-1. Basic principles of getting started with embedded drivers (color format, FB, 8080/RGB interface)

It mainly introduces the basic principles of LCD display, involving pixel, resolution, color model, RGB888 and other formats, Framebuffer, 8080 interface, and RGB interface.

Reference materials: LCD-1. Basic principles of getting started with embedded drivers (color format, FB, 8080/RGB interface)

1. The basic principle of LCD displaying pictures

LCD is used as a display, and its display principle is the same as that of pictures.

A picture can be regarded as composed of one point (that is, pixel pixel ). Each line has xres pixels and yres line, then the resolution ( resolution ) of this picture is: xres * yres.

In the same way, the LCD screen is also composed of pixels. To display a picture with the same resolution, change the pixels on the LCD corresponding to the picture to the same color.

Our goal now becomes to modify the color of a point on the LCD. How to express color? It must be sending data to the LCD, so the question becomes what is the relationship between data and color?

2. Basic knowledge of color

There are many color models for color . I am not a professional in this area, but I just need to know that a color model is equivalent to using different formats to describe a color. The common ones are RGB, YUV, HSV, HSI, etc. The most commonly used is RGB, we start with RGB.

The RGB model uses the three primary colors of red, green and blue to describe a color, and all colors are mixed with red, green and blue.

So you can think that a pixel contains RGB three data. The combination of the three data is the data on one pixel. How many bits is this data? This creates a concept: bpp ( bits per pixel ), how many bits are used to represent each pixel.

You can use 24-bit data to represent red, green and blue, or you can use 16 bits (and others), such as:

24bpp: RGB888 will actually use 32 bits, 8 of which are not used, and 8 of the remaining 24 bits are used to represent red (R), green (G), and blue (B)

16bpp: RGB565 , RGB555

    • RGB565: 5 bits for red, 6 bits for green, 5 bits for blue

    • RGB555: In 16-bit data, use 5 bits to represent red, 5 bits to represent green, and 5 bits to represent blue, wasting one bit

Now that we know the relationship between data and color, how does the data get to the pixels?

3. Framebuffer and LCD controller

As we have known before, to let the LCD display pictures is to modify every pixel on the LCD. The place where all LCD pixel data is stored together (not necessarily all, in short, the data is stored) is called Framebuffer , frame is a frame, a picture can be called a frame, and buffer is a cache.

The LCD controller (LCD Controller) fetches data from the Framebuffer and modifies the LCD.

So one job to drive the LCD is to set up the LCD controller . Let's not talk about how to set it up, assuming we will set it up.

4. Two types of LCD

The Framebuffer can be inside the LCD or outside, which divides the LCD into two categories.

A type of single-chip microcomputer suitable for weak performance such as stm32f1, 51, called LCD module (LCM) :

It integrates Framebuffer, LCD controller, LCD screen

One type is suitable for MPU\SOC with strong performance, such as S3C2440, IMX6ULL, it only has LCD screen, LCD controller is in SOC, Framebuffer may be external memory.

Obviously, the structure is different, and the interface between the LCD and the chip must be different. The communication interface between the LCM and the microcontroller is generally the 8080 interface. The interface between LCD screen and SOC communication is generally RGB interface

5. LCD interface

Introduce two commonly used interfaces

5.18080 interface

The interface to LCM 8080 is very simple, just like memory.

Need to read data, so there is a read signal RD ;

Need to write data, so there is a write signal WR ;

It is necessary to distinguish this module from other things, so there is a chip select signal CS ;

Need to transmit data, need data line DB0-DB15 ,

It is necessary to distinguish the transmitted address, so the address line is needed, but the address line and the data line are shared, and the RS signal is used to distinguish whether the address or data is transmitted on DB0-DB15.

5.2RGB interface

The RGB interface is the interface between the LCD controller and the LCD screen. The principle can be thought of as the LCD controller to modify pixels one by one.

After modifying a pixel, you need to know when to switch the next pixel, so there is clock signal DCLK;

Need to know when a row of pixels has been changed (because it is going to the next row), so there is a horizontal synchronization signal HSYNC (Horizontal Synchronization);

You need to know when all the changes are completed (because you have to return to the first position after the change), so there is a vertical synchronization signal VSYNC (Vertical Synchronization);

Data is required, so there are three sets of RGB lines;

When switching (switching to the next line, switching to the first position), the data is invalid, so the data enable signal DE is required.

It seems complicated, but it is actually setting up the LCD controller.

At this point we understand that no matter what kind of LCD it is, what we need to do is to set the LCD controller and prepare data . Different LCDs have different driving methods and data formats, which must be determined according to the LCD manual. Specific examples will be given in future articles.

Finally, attach a mind map of all knowledge points

More content and reference materials: LCD-1. Basic Principles of Getting Started with Embedded Drivers (Color Format, FB, 8080/RGB Interface)

Guess you like

Origin blog.csdn.net/freestep96/article/details/130979243