Design of Economical and Fast Human-Machine Interface Based on RA8875

With the continuous development and maturity of TFT color liquid crystal technology and the continuous improvement of people’s sensory requirements for human-machine interface, more and more products choose TFT color screen with touch as the human-machine interface. This paper proposes a compromise solution for the performance of RA8875.

introduction

With the continuous development and maturity of TFT color liquid crystal technology and the continuous improvement of people’s sensory requirements for human-machine interface, more and more products choose TFT color screen with touch as the human-machine interface. This paper proposes a compromise solution for the performance of RA8875.

1 RA8875 characteristic analysis

RA8875[1]It is a 256/64K color TFTLCD controller launched by Ruiyou Company, which supports a maximum resolution of 800×480. The internal structure of RA8875 is omitted – editor’s note.

In this design, the following functions of RA8875 are mainly involved:

① The resolution below 480×272 supports dual layers, especially, supports the transparent mode Display of layer 1, that is, after setting the transparent color (BGTR Color) of layer 1 (Layer 1), overlay it on layer 2 (Layer2), the part of Layer1 that originally displayed the transparent color will no longer be displayed. Its display effect is shown in Figure 1.

② Through the DMA function of continuous/block data mode, the data in the SPIFlash can be quickly moved to the RA8875 video memory for display.

③ You can directly access the plug-in font library of the specified model, display 16×16, 24×24, 32×32 dot matrix text, and support two text display modes with background color and transparent.

④ Built-in accelerated drawing engine for lines, rectangles, rounded rectangles, and ellipses. Taking the drawing of an ellipse as an example, after specifying the center point, long and short axis, and color of the ellipse, start drawing, and RA8875 will automatically draw the ellipse according to the specified parameters.Figure 2 is the RA8875 user manual[1]The program flow diagram given in .in[65hA8h]etc. are the corresponding registers in the RA8875.

Design of Economical and Fast Human-Machine Interface Based on RA8875
Figure 1 Display rendering of layer overlay

Design of Economical and Fast Human-Machine Interface Based on RA8875
Figure 2 The program flow of drawing an ellipse

⑤ RA8875 has a set of 10-bit ADC and its control module, which can be used to control 4-wire resistive touch screen.Use the manual mode of the RA8875 touch controller with the median filtering method and three-point calibration[2]Then, the coordinates of the touch screen and the TFT screen can be overlapped, and the error value is within 10 pixels, which meets the design requirements.

⑥ With 2 groups of pulse width modulation (PWM1, PWM2), it can be easily used for LCD backlight adjustment.

⑦ With 1 GPOX, it can be easily used to output high/low level.

2 System Composition

As shown in Figure 3, the system consists of two parts, namely the man-machine interface editing software on the PC side and the man-machine interface composed of RA8875.

Design of Economical and Fast Human-Machine Interface Based on RA8875
Figure 3 System composition diagram

2.1 Human-machine interface editing software on PC

The man-machine interface editing software on the PC side consists of two parts: interface editing and interface compilation. The interface editing (generating *.opt project file) is used by the designer to add/edit each display page and the display elements contained in it according to the human-machine interface function, such as pictures, texts, and geometric figures. In particular, the normal image and the pressed image are allowed to be set, which is mainly to reflect the state of the key up/down in a more beautiful and timely manner when the image is used as the touch key in the man-machine interface. The interface compilation part integrates and packages the project file (*.otp), and compiles and generates a resource file (*.otpbin) according to the interface protocol.

2.2 Man-machine interface composed of RA8875
As shown in Figure 3, the man-machine interface composed of RA8875 is mainly composed of 7 parts: RA8875, MCU, SPIFlash, font library, TFT digital screen, backlight driver, and 4-wire resistive touch screen. Figure 4 is a circuit diagram of the connection between the RA8875 and various components.

Design of Economical and Fast Human-Machine Interface Based on RA8875
Figure 4 Circuit block diagram of RA8875

① Although RA8875 can support 8-bit or 16-bit 8080/6800 series data bus interface and I2C bus or 3/4-wire SPI serial interface, its BTE engine function is only open to parallel MCU interface[1]and RA8875 has 8-bit registers inside, so this design uses STM32F103VCT6[3]8-bit FSMC function to control.

② Although the RA8875 can quickly display the image data pre-stored in the SPIFlash by DMA, it has the defect that the Flash cannot be written. In the software debugging stage, it can be considered to export the serial port of the MCU, access the SPIFlash through the SPI port of the MCU, and download the *.otpbin file to the SPIFlash. In the specific implementation of this design, SPIFlash with a storage capacity of 128 Mb is used[4]Save the resource file (*.otpbin) and some other system data including touch screen calibration information that need to be saved after power-off. MCU and RA8875 share a set of 4-wire SPI bus to access the SPIFlash. In order to avoid the interference problem that the RA8875 cannot read the image data normally because the MCU does not fully release the SPI bus, when the RA8875 needs to access the SPI bus, the MCU needs to execute the program flow shown in Figure 5.

Design of Economical and Fast Human-Machine Interface Based on RA8875
Figure 5 MCU flow chart

③ RA8875 supports 5 kinds of Jitong font chips[1]GT23L32S4W is used in this design[5]. The combination of the two supports 15×16, 24×24, 32×32 dot matrix GB2312 standard characters and 8×16, 12×24, 16×32 dot matrix ASCII characters.

④ The TFT driver module of RA8875 is used to drive the signals of the TFT digital screen, including clock signal (PCLK), valid signal (DE), vertical synchronization signal (VSYNC), horizontal synchronization signal (HSYNC), data signal (PDAT)[15:0]). By using the timer interrupt inside the STM32 to do accurate timing, the speed indicators of the TFT digital screen of various pixels are obtained, as listed in Table 1.

Table 1 Test results of speed index
Design of Economical and Fast Human-Machine Interface Based on RA8875

As the resolution of the display screen increases, the processing time required increases accordingly, and the refresh rate can reach more than 24 frames at 480×272 pixels. Due to the effect of human visual retention, the updated display content does not flicker at this speed. sense, can be accepted by the human eye. Speed ​​index test results omitted – Editor’s Note. In this design, a 480 (RGB) × 272 dot matrix TFT digital screen with a driver IC of OTA5180A is used. Figure 6 shows the interface definition and wiring diagram of the screen.

Design of Economical and Fast Human-Machine Interface Based on RA8875
Figure 6 TFTLCD module pin definition and wiring diagram

⑤ As shown in Figure 7, use RT9293[6]As the driver chip of the backlight WLED, the voltage of the feedback pin (FB) is adjusted through the PWM1 of the RA8875 to realize the backlight brightness adjustment. In addition, RA8875 has a GPOX pin, the output level of this pin can be modified by accessing the C7h register of RA8875. In this design, it is connected to the enable terminal (LED_EN) of RT9293. When the whole system is ready, it needs to be When the display is turned on, pull it high to enable the backlight.

Design of Economical and Fast Human-Machine Interface Based on RA8875
Figure 7 Backlight circuit diagram

⑥ Connect XN, YN, XP, YP of RA8875 to the 4-wire resistive touch screen, the system can continuously monitor touch events, in order to improve the ADC conversion stability, add a 10 μF capacitor to the ground.

3 System software design

3.1 Analysis of Interface Protocol

Reasonable resource file interface protocol is the key to generate human-machine interface quickly. Integrating project files in PC-side human-machine interface editing software into a compact hexadecimal byte stream file is a resource file. This resource file is essentially composed of multiple tables (structures), image modulo data, and string data. The resource table is stored at the first byte of the resource file, and the important information contained in the table includes: the number of page information tables, the entry address of the page information table, the number of image information tables, and the entry address of the image information table. According to the interface protocol, this interface is actually composed of multiple tables.

3.1.1 Page Information Table

A page is a one-screen display interface that can contain a variety of elements. This is set according to the functional characteristics of RA8875 and general display needs, including display images, texts of different colors, line segments, rectangles, rounded rectangles, ellipses, etc.

The information registered in the page information table includes the unique identification value of the page, the number of page elements, and the address of the page element table. The page element table stores the attribute tables of different elements such as the text, line segment, ellipse frame, and picture mentioned above. For example, for the ellipse frame element, its main attributes are the center point of the ellipse, the major and minor axes. After the MCU parses the content of the attribute table of the ellipse element, it drives the RA8875 to display the ellipse according to the process.

3.1.2 Image information table

The information of one or more images is registered in the image information table, including image unique identifier, size, and image modulo data. When it is necessary to display or cut the display image, it only needs to operate the individual registers of the RA8875, and the display work can be completely completed by the DMA of the RA8875. Its operation process is shown in Figure 8.

Design of Economical and Fast Human-Machine Interface Based on RA8875
Figure 8 Flow chart of operating RA8875 to complete image display

3.2 Execution of the interface protocol by the human-machine interface

RA8875 supports dual-layer display at 480×272 pixels. In this design, Layer2 is set as the layer that displays the loaded resources, and Layer1 is set as the layer that is dynamically displayed according to the actual needs of the scene. Layer 1 is superimposed on Layer 2 with a transparent background color (also called transparent color), as shown in Figure 2. Select a color that will not be used in Layer1 from 64K colors as the transparent color. When the on-site data needs to be updated, use the transparent color to partially clear the screen or use it as the text background, so that the on-site data can be directly superimposed on the man-machine interface. Does not destroy the effect of the page. Figure 9 is a flowchart of the operation of the RA8875.

Design of Economical and Fast Human-Machine Interface Based on RA8875
Figure 9 Execution flow chart of the interface protocol

4 System performance analysis

In this design, 128 Mb Flash is used to store resource files, which can store 64 full-screen images. If it is a page without pictures, most of the data is less than 1 KB/page, and it can also store tens of thousands of pages. Human-machine interface is enough.

Since SPIFlash supports continuous reading of data of any length from any address, especially the SPI interface of STM32 supports the DMA function, which can easily load various resource tables and information tables, so there is no large consumption of memory and long-term CPU usage. Leave enough resources for the MCU to handle other more important real-time tasks in the embedded system.

The interface diagram of the PC-side human-machine interface editing software used in this design is omitted – editor’s note.

Epilogue

On the basis of making full use of the characteristics of RA8875 and the advantages of PC visual editing, a complete set of man-machine interface design schemes are proposed, which have been embedded in different man-machine interface designs. Although the workload of PC-side development was added in the early stage, this method that only takes up a small amount of MCU work time and code space is very suitable for low-cost shortening of product development cycles.

The Links:   MG50J2YS40 SKMD150F12 BUY-LCD