LCD Control and Touch Screen Interface Design Based on ARM Processor
2026-04-06 06:22:49··#1
Abstract: This paper presents an in-depth analysis and research on a human-machine interface control system composed of an S3C44B0X controlling a color display screen and a four-wire resistive touchscreen. The pin functions and working principles of the S3C44B0X's built-in LCD controller, the LM7M632 LCD screen, and the ADS7843 touchscreen controller are introduced. The interface design between the S3C44B0X and the LM7M632 and ADS7843 is completed. The driving process of the LCD and touchscreen is discussed, and the color LCD display and touchscreen control functions are realized. Experiments show that this system has good versatility and can be applied to other embedded systems. Keywords: ARM processor; S3C44B0X; LCD; ADS7843; touchscreen; Introduction With the continuous development of information technology, embedded systems are being increasingly widely used in aerospace, consumer electronics, communication equipment, and other fields. In embedded systems, the LCD, as one of the main human-machine interaction devices, is an indispensable part of the display system. In recent years, with the continuous improvement of microprocessor performance, especially the emergence of the ARM processor series, the functions of embedded systems have become increasingly powerful. LCDs have become the preferred output device in embedded systems due to their low power consumption, small size, low price, low driving voltage, and superior character and graphic display functions. With the development of multimedia technology, monochrome LCDs can no longer meet people's higher requirements in various multimedia applications, and color LCDs are being used more and more widely in embedded systems. Touch screens are a convenient tool for people to obtain information and have been widely used in various industries such as industry and commerce, taxation, and banking that need to provide information services to the public [1]. Touch screens, as a special computer peripheral, are currently the simplest, most convenient, and most natural way of human-computer interaction. They give multimedia a brand-new look and are a very attractive new multimedia interactive device [2]. The S3C44B0X is a RISC microprocessor based on the ARM7TDMI core produced by Samsung, with a main frequency of up to 66MHz [3]. It integrates peripheral devices including LCD controllers. The LM7M632 is an STN type color LCD display with a resolution of 640×240 launched by Sharp, which supports 256 colors [4]. This article focuses on the interface design of S3C44B0X with LM7M632 and ADS7843, as well as the driving process of LCD and touch screen. 1. Introduction to the built-in LCD controller in S3C44B0X The built-in LCD controller in S3C44B0X can support 4-level grayscale, 16-level grayscale black and white LCD and 256-level color LCD screen; it supports 3 types of LCD drivers: 4-bit dual scan, 4-bit single scan, and 8-bit single scan display modes. The built-in LCD controller is to transmit the LCD image data located in the display buffer in the system memory (SDRAM) to the external LCD driver and generate the necessary LCD control signals [5]. Figure 1 is a block diagram of the internal structure of the LCD controller. Among them, VCLK is the pixel clock signal between the LCD controller and the LCD driver; VLINE is the line synchronization pulse signal between the LCD controller and the LCD driver; VFRAME is the frame synchronization signal between the LCD controller and the LCD driver. VM is the AC signal of the LCD driver. VD[3∶0] and VD[7∶4] are LCD pixel data output ports. Figure 1: Internal structure of the LCD controller. Figure 2: LCD module and hardware interface . The LM7M632 operates in 8-bit single-scan mode. The 8-bit single-scan mode means that the display uses 8 parallel data lines to continuously shift and output "row" data until the entire frame's data has been shifted out. The definition of the LCD module interface signal lines is shown in Table 1. Figure 2 shows the connection diagram of the hardware interface between the LCD controller and the LCD. In the hardware circuit of this display system, the connection between the built-in LCD controller in the S3C44B0 and the LCD module LM7M632 is crucial. Figure 3 is the timing diagram of the LM7M632 module interface. YD is the frame (data filling the entire screen is called one "frame") synchronization signal, which starts the data for a new frame on the LCD screen. The time length between two YD pulses is called the "frame period." According to the characteristics of the LCD module, the frame refresh period is 12ms to 14ms, and the frequency is 70Hz to 80Hz. Each frame contains 240 LP pulses. LP is the row (240 rows in total) data input latch signal, which starts the data for a new row on the LCD screen. It is also the row synchronization pulse signal. Each row includes 640 × 3/8 XCK pulse signals. XCK is the row data input signal, which is the clock signal for data transmission of pixels in each row; each group of 8 bits of data is latched at the falling edge of XCK. D0~D7 are 8-bit display data input signals. Table 1: LCD module (LM7M632) interface signal line definition. Figure 2: LCD controller and LCD hardware connection method. Figure 3: LM7M632 module interface timing diagram. In this display system, the display method is to directly manipulate the contents of the display buffer (SDRAM). The LCD controller obtains data from the display buffer via DMA, without CPU intervention. In the 256-color display mode, one byte of data in the display buffer represents the color information of one point on the LCD. Therefore, the required buffer size is 640 × 240 × 1 bytes, where the RGB data format of each byte is: composed of 3 bits of red (Bit7~Bit5), 3 bits of green (Bit4~Bit2), and 2 bits of blue (Bit1~Bit0). 3. Touch screen principle and hardware interface Touch screens can be divided into several types according to their working principle, such as surface acoustic wave screens, capacitive screens, resistive screens and infrared screens [6]. The most common type is the resistive touch screen, whose screen body is a multi-layer composite film that fits very well with the surface of the display. When the touch screen is working, the upper and lower conductor layers are equivalent to a resistive network. When a voltage is applied to a certain electrode, a voltage gradient will be formed on the network. If an external force causes the upper and lower layers to contact at a certain point, the voltage at the contact point can be measured on the other electrode without voltage, so as to know the coordinates of the contact point. ADS7843 is a four-wire resistive touch screen conversion interface chip produced by TI. It is a 12-bit sampling analog-to-digital converter with a synchronous serial interface. The power consumption is 750µW at a throughput rate of 125kHz and a voltage of 2.7V, while the power consumption in shutdown mode is only 0.5µW. Due to its low power consumption and high speed, it is widely used. Figure 4 shows the connection circuit between S3C44B0 and ADS7843. X+, Y+, X-, and Y- are the analog input terminals of the converter; DCLK is the external clock input; CS is the chip select terminal; DIN is the serial input, through which control data is input; DOUT is the serial data output, used to output the converted touch position data. The maximum number is 4095 in binary; IN3 and IN4 are auxiliary inputs; PENIRQ is the PEN interrupt pin. Among them, S3C44B0 selects the PG port to interface with ADS7843, using a total of 6 lines from PG2 to PG7. 4. Color LCD Display and Touch Screen Software Design 4.1 LCD Display 4.1.1 Initialize the LCD Port. Since the LCD module is connected to the S3C44B0, and the LCD uses 8-bit data lines, the C and D ports of the S3C44B0X must be initialized. The procedure is as follows: rPDATC = rPDATC &~ (1 << 8) | (1 << 8); // Enable LCD rPCONC = rPCONC &~ (0xff << 8) | (0xff << 8); // Configure VD[7∶4] rPCOND = 0xaaaa; // Configure VD[3∶0], VCLK, VLINE, VM, VFRAME rPDATC=0xffff; 4.1.2 Allocate a display buffer of 640×240 bytes. The display buffer is a region in the system memory used to store the image data to be displayed. By directly putting the image data to be displayed into the display buffer, the image can be directly displayed on the LCD screen. The procedure is as follows: frameBuffer256 = (unsigned char*)malloc(ARRAY_SIZE_COLOR); where ARRAY_SIZE_COLOR = 640×240 4.1.3 Initialize LCD control registers Before turning on the LCD, the registers related to the LCD controller should also be initialized [6] so that the configuration of the LCD controller matches the characteristics of the external LCD display module, including setting the LCD resolution, scanning frequency, display mode, generating control signals and control timing, etc. 4.1.4 LCD display After the LCD is initialized, since the CPU does not support file management in S3C44B0X, the image to be displayed must be included in the program. For example, if you want to display a 640×240 image on the LCD, in actual operation, you should first use a conversion tool (such as Image2Lcd) to convert the image into a C format array file, that is, convert the color of each pixel into a byte, and then save the entire file as a 240×640 array. Then, include the file in the project and use a loop statement to display it. The method and principle for displaying Chinese characters, symbols, and numbers are basically the same as for displaying images. 4.2 Touchscreen Software Design 4.2.1 Touchscreen Mode Settings The ADS7843's reference voltage mode settings are divided into two types: single-ended mode and differential mode. In single-ended mode, the reference input voltage is selected as Vcc and GND. Due to the voltage drop of the internal switching resistor affecting the conversion result and causing errors, the low-resistance switch inside the converter has a certain impact on the conversion accuracy. In differential mode, the reference input is provided by the unselected input channels Y+, Y-, X+, and X-, which provide the reference power and ground. Regardless of how the internal switching resistor changes, the conversion result is always proportional to the resistance of the touchscreen, overcoming the influence of the internal switching resistor. However, when the conversion frequency is very high, it increases power consumption, requiring consideration of low-power design. 4.2.2 PENIRQ Function Because the power consumption increases during touchscreen A/D sampling, in the software design, A/D conversion is only required when the user presses the touchscreen. In order to reduce power consumption and make full use of the chip's capabilities, the hardware circuit is designed to send an interrupt to the MCU via PENIRQ when the touch screen is pressed. At the same time, the software is configured to use the pen interrupt function of ADS7843 to reduce power consumption. When the touch screen is pressed, the PENIRQ pin potential becomes low. After the MCU receives the interrupt request, it can issue a start conversion command and query the BUSY pin until the conversion is completed and retrieve the coordinates. The start conversion is performed in two steps to obtain the coordinates in the x and y directions respectively. 4.2.3 Touch screen program design flow fully weighs the advantages and disadvantages of single-ended mode and differential mode. This system selects the differential mode as the input mode of the reference voltage. The status word [7] used by the control program is set as follows: X channel 0x90, Y channel 0xD0. The touch screen program flow is shown in Figure 5. In the program, the S3C44B0X's GPG7 detects whether PENIRQ is low when triggered by the falling edge. If it is low, it is considered that the touch screen has been pressed; otherwise, it is considered that the touch screen has not been pressed. When using the I/O ports to simulate 3-wire serial transmission on DIN, DOUT, and DCLK, the control word for the read x or y axis coordinate values is sent to the ADS7843, and then the coordinate values are serially read out. The coordinate values are sent to the S3C44B0X, and after processing by the CPU, the corresponding information is displayed on the LCD and the corresponding parameter instructions are executed. The entire system can be controlled via the touchscreen according to the prompts on the LCD, thus completing the human-machine interaction function. 5. Conclusion In embedded systems, the LCD plays a crucial role as one of the main human-machine interaction devices. This paper completed the hardware and software design of the S3C44B0X controlling the LCD and touchscreen. Practice has proven that the system is stable and reliable, achieving the expected results. This paper provides a practical solution for the hardware design and control driver of the LCD in the human-machine interface, and this solution can be applied to other embedded systems. References [1] Li Li, Li Min, et al. Design of a Chinese character input method based on MIS touch screen [J]. Microcomputer and Information, 2006.23: 98-91. [2] Lai Cheng, Touch screen principle and its application in single-chip microcomputer system [J]. Modern Business, June 2006 (late issue) No. 471 [3] Samsung Electronics User's Manual S3C44B0X 32BitRISC Microprocessor [Z]. 2003. [4] Sharp Microelectronic User's Manual LM7M632 Passive Matrix LCD Module [Z]. 1998. [5] Li Yan, Rong Panxiang. Principles and applications of embedded µCLinux system based on S3C44B0X [M]. Beijing: Tsinghua University Press, 2005.1 [6] Chen Ze. ARM Embedded Practice Tutorial [M]. Beijing: Beijing University of Aeronautics and Astronautics Press, 2005.2. 149-150 [7] ADS7843 Datasheet[Z]. TI, JULY.2001