LCD Control Based on NIOS II Embedded Processor

Publisher:SereneNatureLatest update time:2011-11-15 Source: 电子产品世界Keywords:NIOS Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.


Keywords:NIOS Reference address:LCD Control Based on NIOS II Embedded Processor

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

Analysis of vibration alarm of 5C II 250MX3 centrifugal compressor
Vibration alarm analysis of 5C II 250MX3 centrifugal compressor     Abstract Through the phenomenon of excessive vibration of the 5C II 250MX3 compressor and its treatment process, this paper briefly explains the problems that this type of centrifugal compressor is prone to in the production and operation process, an
[Analog Electronics]
Small current measurement leakage and protection II
Guarding can also be used to reduce leakage current in cable connections. Figure 12 shows the principle of driving a guard to prevent the leakage resistance of the cable from affecting small current measurements. In an unguarded configuration, the leakage resistance of the coaxial cable is in parallel with the DUT (RDU
[Test Measurement]
Small current measurement leakage and protection II
Application of mC/OS-II in GPRS Terminal System
The real-time embedded operating system mC/OS-II is aimed at small and medium-sized embedded applications. The kernel including all functional modules is about 10KB, and the amount of RAM used is mainly related to the number of tasks in the system. GPRS is a data service developed on the basis of the currently
[Microcontroller]
Application of mC/OS-II in GPRS Terminal System
Design of CAN bus driver based on ERTOS
MC/OS-II is a free, open-source embedded real-time kernel written by American Jean Labrosse. It is a real-time embedded operating system ERTOS (Embedded Real Time Operation System) with high practical value for technicians who develop computer embedded application products  .   To develop a perfect ERTOS, a lot of wor
[Automotive Electronics]
Design of CAN bus driver based on ERTOS
Design of digital microwave monitoring system based on ARM chip LPC2214 and μC/OS-II
With the popularization and deepening of embedded system development, traditional software development methods are difficult to meet the needs of more complex applications. Embedded operating systems play an increasingly important role in development and have been widely used in mobile phones and mobile computers. Equ
[Microcontroller]
Design of digital microwave monitoring system based on ARM chip LPC2214 and μC/OS-II
ucos-ii example 3: mutex semaphore test
environment: Host: WIN8 Development environment: MDK4.72 ucgui version: 3.90 ucos version: ucos-ii mcu: stm32f103VE illustrate: This example creates a new mutually exclusive semaphore. Only one task can use the resource function resource at a time through this semaphore. Notice: 1. Mutex semaphores cannot be creat
[Microcontroller]
ucos-ii example 3: mutex semaphore test
Multi-serial communication programming method under embedded real-time operating system μC/OS-II
    This paper introduces the multi-serial port communication programming method based on LPC2365 as the core processor and embedded real-time operating system μC/OS-II. For short byte frame data of fixed length, the data receiving task is completed by setting the appropriate byte trigger depth; for long byte frame da
[Microcontroller]
Multi-serial communication programming method under embedded real-time operating system μC/OS-II
Gallium nitride power chip company Navitas Semiconductor will acquire Live Oak II
Navitas Semiconductor, an industry leader in GaN power chips, will go public through a merger with Live Oak II special purpose acquisition company with an enterprise value of $1.04 billion   • The transaction will raise approximately US$400 million in funds, including oversubscription of additional shares worth US$145
[Internet of Things]
Gallium nitride power chip company Navitas Semiconductor will acquire Live Oak II
Latest Industrial Control Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号