background knowledge
1. Hardware requirements for LCD operation:
To make an LCD display text or image normally, it needs not only LCD driver but also corresponding LCD controller. Usually, the manufacturer will make LCD driver together with LCD glass substrate in the form of COF/COG, while LCD controller is realized by external circuit. Now many MCUs have integrated LCD controller, such as S3C2410/2440. LCD controller can generate control signal required by LCD driver to control STN/TFT screen.
2. S3C2440 internal LCD controller structure diagram:
Let's describe the LCD controller integrated in the S3C2440 according to the data sheet:
a: LCD controller consists of REGBANK, LCDCDMA, TIMEGEN, and VIDPRCS registers;
b: REGBANK consists of 17 programmable registers and a 256*16 palette memory, which are used to configure the LCD controller;
c: LCDCDMA is a dedicated DMA that can automatically transfer video data in the memory to the LCD driver. By using this DMA channel, the video data is displayed on the LCD screen without the intervention of the CPU;
d: VIDPRCS receives data from LCDCDMA, converts the data into a suitable data format, such as 4/8-bit single-scan, 4-bit double-scan display mode, and then transmits the video data to the LCD driver through the data port VD[23:0];
e: TIMEGEN is composed of programmable logic. It generates the control signals required by the LCD driver, such as VSYNC, HSYNC, VCLK and LEND, etc. These control signals are closely related to the configuration of LCDCON1/2/3/4/5 in the REGBANK register group. Through different configurations, TIMEGEN can generate different forms of these signals to support different LCD drivers (that is, different STN/TFT screens).
3. Common TFT screen working timing analysis:
External interface signals provided by LCD:
VSYNC/VFRAME/STV: vertical synchronization signal (TFT)/frame synchronization signal (STN)/SEC TFT signal; |
All monitors display images from top to bottom and from left to right. What does this mean? Well, an image can be considered a rectangle, consisting of many neatly arranged dots in rows, and these dots are called pixels. So the display principle of this image on an LCD is:
A: The display pointer starts from the first point of the first row in the upper left corner of the rectangle, and is displayed on the LCD one by one. The timeline in the above timing diagram is VCLK, which we call the pixel clock signal; |
The meanings of the clock delay parameters in the above timing diagram are as follows: (The LCD manufacturer will provide the corresponding data sheet for the values of these parameters)
VBPD (vertical back porch): indicates the number of invalid rows after the vertical synchronization signal at the beginning of a frame of image, corresponding to the upper_margin in the driver; |
The values of the above parameters will be saved in the LCDCON1/2/3/4/5 registers in the REGBANK register group respectively: (For the operation of the registers, please refer to the LCD section of the S3c2440 data sheet)
LCDCON1: 17 - 8-bit CLKVAL |
4. Frame Buffer:
Frame buffer is an interface provided by Linux for display devices. It describes some display devices as a buffer, allowing applications to access these graphics devices through the interface defined by FrameBuffer, without having to worry about the specific hardware details. For frame buffer devices, as long as the color value is written to the area corresponding to the display point in the display buffer, the corresponding color will be automatically displayed on the screen. Let's take a look at the correspondence between the buffer and the display point in different color bit modes:
5. LCD hardware circuit:
The above summary is transferred from: http://blog.chinaunix.net/u3/101649/showart.php?id=2188364
In conclusion:
1.s3c2440 provides us with a convenient LCD interface (GPC pins are used for VD[7:0], LCDVF[2:0], VM, VFRAME, VLINE, VCLK, LEND) (GPD pins are used for VD[23:8]) For details, see the datasheet of s3c2440.
2. For controlling TFT LCD, you only need to set registers LCDCON1~LCDCON5 (used to select LCD type, set time characteristics of various control signals, etc.) and LCDSADDR1~LCDSADDR3 (used to set frame memory address). For the settings of these registers:
/*
Among them, the parameters VBPD, VFPD, VSPW, HBPD, HFPD, and HSPW are provided by LCD manufacturers and can be modified according to their datashet. =================================================================================== /* * Set the LCD controller address register LCDSADDR1~3 * The frame memory is completely consistent with the viewpoint, * The image data format is as follows (at 8BPP, the data in the frame buffer is the index value in the palette): * |----PAGEWIDTH----| * y/x 0 1 2 639 * 0 idx idx idx ... idx * 1 idx idx idx ... idx * 1. LCDSADDR1: * Set LCDBANK, LCDBASEU * 2. LCDSADDR2: * Set LCDBASEL: frame buffer end address A[21:1] * 3. LCDSADDR3: * OFFSIZE is equal to 0, PAGEWIDTH is equal to (640/2) */ |
3. Partial code appreciation:
/* |
4. Upload the complete code, make to generate lcd.bin. Download it to nandflash and run it. Output in the serial terminal:
##### Test TFT LCD ##### [1] TFT320240 8Bit [2] TFT240320 16Bit [3] TFT640480 8Bit [4] TFT640480 16Bit Enter your selection: 1 Initializing GPIO ports.......... [TFT 64K COLOR(16bpp) LCD TEST] 1. Press any key to draw line 2. Press any key to draw circles 3. Press any key to fill the screem with one color 4. Press any key to fill the screem by temporary palette 5. Press any key to fill the screem by palette 6. Press any key stop the testing |
You can see the LCD display.
Previous article:S3C2440 Hardware Part 8: ADC and Touch Screen Interface
Next article:S3C2440 Hardware Part 7: UART
- Popular Resources
- Popular amplifiers
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- [GD32E231 DIY] DAP RTT, beats all printf formats, swo is no longer a thing
- Questions about STM32's FSMC driving SRAM chip
- Design of non-magnetic water meter based on MSP430FW427
- Graduation Project Circuit Design Simulation
- [Revenge RVB2601 Creative Application Development] Dynamic loading model super test case: tearing up the Internet celebrity project small TV
- DSP Interrupt System and Its Application
- The Enlightenment of Passive Optical Networks
- There is a problem adding USB CDC function in the official demo application SDDataLog
- Audio decoding
- Things to pay attention to when learning TMS320C2000