LCD-We played mini2440 (arm9-) bare metal in those years.

Source: Internet
Author: User

LCD-Liquid Crystal Display
 
LCD displays are divided into 1. Static drive, 2. Simple matrix drive, and 3. Active Matrix drive.

The simple matrix can be divided into two types: 1. the torsion column type (TN) and the super steering column type (STN), while the active matrix drive is dominated by TFT.

 

Both TN and STN adopt field voltage driving mode. If the display size is increased, the response time of the center part to the motor changes will become longer, and the display speed will not keep up. To solve this problem, the active matrix-driven TFT was proposed. It turned off the voltage of liquid crystal molecules through the transistor display signal, thus avoiding the dependence of the display on the electrical field effect.

 

An LCD screen not only requires an LCD driver, but also an LCD controller. Many CPU chips are integrated with LCD controllers.

Based on the display principle: As the vsync of the frame synchronization signal, each pulse is sent, which means that the new image data is transmitted. As the hsync of the line synchronization signal, if no pulse is sent, it indicates that the new line of image data starts to be sent.

LCD sequence diagram

The principle of all LCD display images is from top to bottom, from left to right. An image can be seen as a rectangle consisting of many neatly arranged pixels in a row. These vertices are called pixels.

Vclk: pixel clock signal

No pulse signal is sent, indicating that the data of a new vertex image starts to be transmitted.

Lend: Line End Signal

 

Frame Buffer

Framebuffer is essentially the Hardware Abstraction of graphics devices. For developers, framebuffer is a display cache. Writing data in a specific format to the display cache means outputting content to the screen. By constantly writing data to framebuffer, the Controller automatically displays
Buffer.

In the embedded system, a portion of the memory is used as the video memory. Therefore, the essence of frame buffer is the video memory;

 

Frame Buffer Device

Frame buffer device is a typical character device. The device file corresponding to the frame buffer device is/dev/FB *. If the system has multiple display cards, Linux supports multiple frame buffer devices, up to 32, they are/dev/fb0 to/dev/fb31 respectively, while/dev/fb0 is the current default frame buffer device, usually pointing to/dev/fb0. The frame buffer device is a standard character device. The primary device number is 29, and the secondary device number ranges from 0 to 31.

 

Lab content:

1. Clear LCD

Run the command: dd If =/dev/Zero of =/dev/fb0 BS = 240 COUNT = 320

(DD is used to copy objects.If(In file)Of
(Out file) BS: block size count :)

BS = 240
That is, a block is 240 bytes, and count = 320 has 320 blocks.

2. Run the application and draw a picture

./LCD

3. Clear LCD

Run the command: dd If =/dev/Zero of =/dev/fb0 BS = 240 COUNT = 320

1. Show Images

2. Cat
Xx.bmp>/dev/fb0

Conclusion: Using Frame Buffer, we can operate the LCD display image, that is, the LCD display image comes from the frame
Buffer, while/dev/fb0 is frame
Buffer device file, so the operation/dev/fb0 is the operation Frame
Buffer

 

The platform device classification method is: bus;

Character Device Classification Method: Function

# Include <unistd. h> # include <stdio. h> # include <fcntl. h> # include <Linux/FB. h> # include <sys/Mman. h> int main () {int fp = 0; struct fb_var_screeninfo vinfo; struct fb_fix_screeninfo finfo; long screensize = 0; char * FBP = 0; int x = 0, y = 0; long location = 0; FP = open ("/dev/fb0", o_rdwr); // open the frame buffer device file if (FP <0) {printf ("error: can not open framebuffer device \ n "); exit (1);} If (IOCTL (FP, fbioget_fscreeninfo, & finfo )) {// obtain some LCD configuration parameters printf ("error reading fixed information \ n"); exit (2);} If (IOCTL (FP, fbioget_vscreeninfo, & vinfo )) {printf ("error reading variable information \ n"); exit (3) ;}screensize = vinfo. xres * vinfo. yres * vinfo. bits_per_pixel/8; // single frame image space/* ing the content of the file in the FP from the start to the screensize, get a pointer to this space */FBP = (char *) MMAP (0, screensize, prot_read | prot_write, map_shared, FP, 0 ); // map the video memory to the process space. FBP is the ing address. If (INT) FBP =-1) {printf ("error: failed to map framebuffer device to memory. \ n "); exit (4);}/* This is the coordinate of the point you want to draw, (0, 0) in the upper left corner of the screen * // draw a rectangle for (x = 100; x <150; X ++) {for (y = 100; y <150; y ++) {location = x * (vinfo. bits_per_pixel/8) + y * finfo. line_length; * (FBP + location) = 255;/* blue color depth * // * direct value assignment to change the color of a certain point on the screen */* (FBP + location + 1) = 0;/* green color depth * // * Note: These values are set to four bytes per pixel. If the value is 2 bytes per pixel, */* (FBP + location + 2) = 0;/* red color depth * // * For example, rgb565, conversion is required */* (FBP + location + 3) = 0;/* Whether transparent */} munmap (FBP, screensize);/* un ing */close (FP);/* close the file */return 0 ;}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.