With the rapid development of semiconductor technology and computer hardware and software technology, there are more and more ways to control the display of images. This article introduces a new method to control LCD-LQ057Q3DC02 based on NIOS II soft-core processor. In the design, the NIOS II soft-core processor and its "soft" hardware modules related to the display function are customized using FPGA Altera's SOPC Builder to collaboratively implement the software and hardware design of display control. Using SOPC technology, the NIOS II CPU and LCD controller are placed in the same FPGA, which solves the problem that LCD display can only be solved by using a dedicated LCD control chip.
1 LCD selection and main features
The LCD used in this article is SHARP's 5.7-inch LCD-LQ057Q3DC02. It can display 320×240×3 pixels. The input signals include: 18-bit color signal (6 bits for each R, G, and B) data signal, 4 clock signals (CLK, Hsync, Vsync, Enable), and R/L, U/D, and VGA/QVGA mode selection signal lines for horizontal display mode and vertical display mode.
In fact, LCD-LQ057Q3DC02 is a line-by-line scanning device. It always starts scanning from the upper left corner of the screen, first scans a line (320 pixels) horizontally to the rightmost, then returns to the leftmost, changes to the next line, and continues scanning. Until the bottom of the screen is scanned (a total of 240 lines), a frame of the image is scanned, and then returns to the leftmost to start scanning the next frame.
2 Avalon Stream Mode LCD Controller Design
The LCD real-time image display control method implemented in this article adopts the DMA data transmission method. During the design, a DMA transfer channel is established between the streaming mode LCD controller and SDRAM using the DMA controller, allowing the hardware to automatically read the pixel information, and the NIOS II processor can update the LCD image by simply operating the corresponding blocks in the SDRAM.
2.1 Composition of the Avalon streaming mode controller
The Avalon bus specification must be followed when designing Avalon streaming mode peripherals. In actual design, the hardware structure of the Avalon streaming mode LCD controller designed by the author is shown in Figure 1. The controller consists of the following three parts: LCD interface controller, FIFO memory, and Avalon Streaming Port interface.
2.2 LCD display control flow
For LCD-LQ057Q3DC02, to achieve normal LCD display, the corresponding control signals must be correctly configured, especially the line synchronization (LCD_Hsync) and field synchronization (LCD_Vsync) must be synchronized with the image data taken from the SDRAM memory, otherwise, the image will not be reproduced normally. The control timing flow of line synchronization and field synchronization for LCD control is shown in Figure 2.
2.3 LCD controller file composition and part of the code
There are three module files corresponding to the LCD controller hardware, namely: LCD_interface.vhd, LCD_pixel_fifo.v and LCD_controller_stream.v. LCD_controller_stream.v is the top-level module, which also contains the Avalon Streaming Port interface timing part. LCD_pixel_fifo.v can be directly generated through the macro module in QuartusII. After the above three files are generated, you can select the System->Add Interface to User Logic command in SOPC Builder to open the Interface to User Logic dialog box and select the bus type as Avalon Memory Slave, because the LCD controller working in streaming mode can be regarded as a memory (FIFO type), and the DMA setting from memory (FIFO) to memory (SDRAM) can be realized by adding a DMA controller. The following is a partial program of the LCD interface.
ENTITY LCD_interface IS
PORT(
reset :IN std_logic;
lcd_clk :IN std_logic;
Wrdata :IN std_logic_vector(17 downto 0);
hsync :OUT std_logic;
vsync :OUT std_logic;
enable :OUT std_logic;
lcd_R/L :OUT std_logic;
lcd_U/D :OUT std_logic;
sel_VGA_QVGA :OUT std_logic;
RGB :OUT std_logic_vector(17 downto 0);
end_of_picture :OUT std_logic);
END LCD_interface;
ARCHITECTURE trans OF LCD_interface IS
process(lcd_clk) begin
if(rising_edge(lcd_clk)) then
if(hcnt<400) then
hcnt<=hcnt+1;
else
hcnt<=(others=>0);
end if;
end if;
end process;--行计数器模块
process(lcd_clk) begin
if(rising_edge(lcd_clk)) then
if(hcnt=320) then
if(vcnt<262) then
vcnt<= vcnt+1;
else
vcnt<=(others=>0);
end if;
end if;
end if;
end process;--场计数器模块
process(lcd_clk) begin
if(rising_edge(lcd_clk)) then
if((hcnt>= 320+20+20 ) and (hcnt<320+20+20+40)) then
hs<=0;
else
hs<=1;
end if;
end if;
end process;--产生水平同步脉冲
process(vcnt)begin
if((vcnt>=240+6+6)and(vcnt<240+6+6+10)) then
VS<=0;
else
vs<=1;
end if;
end process;--产生场同步脉冲
process(lcd_clk) begin
if(rising_edge(lcd_clk)) then
if(hcnt<320 and vcnt<240)and(hcnt>20 and vcnt>6) then
en<=1;
else
en<=0;
end if;
end if;
end process;--产生显示使能控制信号
process(led_clk)begin
if(rising_edge(lcd_clk))then
if(hcnt<320 and vcnt<240)then
RGB<=Wdata;
else
RGB<=(others=>0);
end if;
end if;
end process;--像素输出及消隐
process(lcd_clk)begin
if(rising_edge(lcd_clk))then
if((vcnt=320+1)and(hcnt=0))then
end_of_picture<=1;
else
end_of_picture<=0;
end if;
end if;
end process;--一帧传输完毕
END ARCHITECTURE trans;
3 DMA控制流程及实验结论
3.1 DMA传输方式下的程序流程
The use of this solution to realize LCD display has been verified in a certain area array CCD acquisition system. In the actual system, this part mainly realizes the dynamic display of the image data collected by the area array CCD image sensor. In the actual acquisition control system, two DMAs are selected, one for image data acquisition and one for image reproduction after acquisition. This article only introduces the corresponding modules under the display DMA transmission control mode. In the actual system, image data is collected from the area array CCD image sensor to SDRAM in DMA control mode, and the collected image data is displayed from SDRAM to LCD. The DMA control flow in the actual system is shown in Figure 3.
3.2 Experimental conclusion
According to Figure 3, the image data of the area array CCD collected is stored in SDRAM. The image data extracted at a certain ratio is synthesized into an 18-bit RGB image signal in SDRAM. Then, under the control of the NIOS II processor and display DMA, a complete frame of the image is displayed on the LCD. The actual control display result is shown in Figure 4.
4 Conclusion
Using NIOS II as a solution for controlling LCD with FPGA embedded processor can easily realize DMA transmission and control of image data. The system can selectively customize the corresponding modules according to actual needs, making the system more flexible. At the same time, since the LCD control is realized by using "soft" hardware, the purpose of improving hardware functions can be achieved by constantly changing the "software" during the debugging process.
Previous article:Component-oriented software architecture of outpatient department information management system
Next article:Optimization of interrupt context protection in embedded Linux
Recommended ReadingLatest update time:2024-11-16 15:25
- Popular Resources
- Popular amplifiers
- DigiKey_Follow_me_II-main
- Principle and Design of Modern Brushless DC Permanent Magnet Motor
- Convex Optimization in Signal Processing and Communications: From Foundations to Applications (Qi Zhongyong, Li Weichang, Lin Jiaxiang)
- Knowledge Enhancement Methods for Natural Language Processing (WSDM2023 Tutorial)
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- The ESP32 branch of MicroPython now has dual cores enabled by default
- I'm almost driven crazy by AD
- stm32 pwm fails after eight cycles
- Summary of MCU delay methods
- Understanding the Q and D values of capacitors
- How to solve the problem of power-on reset confusion in single-chip microcomputers
- Threshold voltage question
- Important network technologies of 5G system
- Start broadcasting at 10:00: Enter the TI robot production classroom and start the journey of deep learning practice! (100% courtesy for invitation viewing)
- Detailed explanation of GPIO input and output modes