Design of interface circuit between ARM HMS30C7202 and touch screen

Publisher:huanguuLatest update time:2011-07-12 Keywords:ARM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Introduction

With the rapid development of modern computer technology and Internet technology, embedded systems have begun to occupy the mainstream of the market. Due to the high performance and low power consumption of 32-bit ARM embedded processors, it has been widely used in scientific research, engineering design, military technology, commercial culture and art, and consumer products. As the latest computer input device, the touch screen has the advantages of being durable, fast in response, space-saving, and easy to communicate. It is mainly used in places such as public information query, industrial control, military command, tourism, electronic games, ordering songs and dishes, multimedia teaching, and real estate pre-sales. Therefore, this article focuses on the interface design based on the embedded microprocessor HMS30C720 and the touch screen controller, and the programming design method combining the underlying serial port driver with the upper microwindows graphical interface to realize the control of the touch screen over the embedded devices.

2. Overall structure of the system

The overall structure of the system is shown in Figure 1: This system consists of an ARM unit and a touch screen control unit. The ARM unit mainly receives the location data information of the touch screen control unit and calls the ARM control and application program according to the location information. We selected Hynix 's ARM CPU HMS30C7202 as the main chip of the ARM system unit. It is a cost-effective 16/32-bit RISC microcontroller based on the Ethernet application system, which contains a 16/32-bit ARM7TDMI RISC processor core designed by ARM [1, 4] . The touch screen control unit mainly completes signal amplification and processing, A/D. According to the digital signal, the position of the icon on the touch screen clicked by the user is identified. And the icon should be called to execute the corresponding instruction. We selected a touch screen controller from a company in Shenzhen. The touch screen controller has the characteristics of serial communication interface and high resolution.

Figure 1 Overall structure of the system

3. Hardware circuit design

3.1 LCD interface circuit

HMS30C7202 has a built-in LCD display controller, and has a dedicated video DMA controller and video bus connected to the SDRAM controller. The separate bus makes the LCD refresh no longer require ARM control, and the data transfer is completely controlled by the DMA controller, which improves the performance of the entire system. HMS30C7202 supports color, monochrome STN LCD displays and TFT color LCD displays, with a display resolution of up to 640×480. This system platform uses 16-bit true color and a 565 color scheme, 5 bits of red, 6 bits of green, and 5 bits of blue. TFT displays all use 18 data lines, so the lowest bits of the red and blue data lines are grounded. In addition to the data lines, the LCD interface also has line and field synchronization signals, LCD clock signals, and LCD control signals, which can be connected to the CPU's LCD control outputs LLP, LFP, and LAC respectively.

3.2 Touch screen hardware circuit

3.2.1 Four-wire resistive touch screen

As shown in Figure 2, it is a schematic diagram of the principle of a four-wire resistive touch screen. The four-wire touch screen contains two resistive layers. One layer has a vertical bus at the left and right edges of the screen, and the other layer has a horizontal bus at the bottom and top of the screen. To measure in the X-axis direction, bias the left bus to 0V and the right bus to V REF . Connect the top or bottom bus to the ADC, and a measurement can be made when the top and bottom layers touch. To measure in the Y-axis direction, bias the top bus to V REF and the bottom bus to 0V. Connect the ADC input to the left or right bus, and the voltage can be measured when the top and bottom layers touch. For a four-wire touch screen, the ideal connection method is to connect the bus biased to V REF to the positive reference input of the ADC, and connect the bus set to 0V to the negative reference input of the ADC.

3.2.2 Touch screen serial port controller interface definition

The relationship between the touch screen interface pins and the RS232 serial port pin functions is shown in Table 1. The RS232 serial port pins are 9 pins, only 5 pins are used, and the touch screen power supply is provided by the 4th pin of the PS/2 interface.

Table 1 Relationship between touch screen interface pins and RS232 serial port pin functions

Pinout

1

2

3

4

5

RS232 serial port pin functions

Data Detection

Receiving Characters

Transmit Character

Data terminal preparation

land

Touch screen serial port pin function

send

take over

land

PS/2 Pin Functions

+5v

land

[page]

4. Determination of communication protocol and software design

4.1 Detailed analysis of the communication protocol of the touch screen serial port controller

Due to the company's commercial reasons, the source code and communication protocol are not provided, and there is no driver for HMS30C7202. With the help of the serial port debugging assistant and storage oscilloscope analysis, we have obtained the communication protocol of the serial port touch screen controller. Its transmission rate is 9600, one frame of data is 10 bits, the start bit is 1, 8 data bits, the stop bit is 0, and there is no check bit. The low bit is sent first and then the high bit. Each data packet transmits 5 bytes of data. The first byte is the control bit, the second and third bytes are the X-axis coordinate values ​​obtained by the touch screen, and the fourth and fifth bytes are the Y-axis coordinates obtained. In this way, we have obtained the communication protocol of the touch screen controller, which provides a basis for writing the corresponding touch screen program under the Linux system.

4.2 Design of touch screen serial communication program

First, write a serial communication program corresponding to the touch screen under the Linux system, compile it with a cross compiler, download it to the target board ARM, and after running it, click the touch screen to get the touch screen output data. In this program, our goal is to establish communication between the touch screen serial port controller and ARM7 serial port 1, so that the read data can be displayed on the corresponding LCD display screen. After setting the corresponding baud rate, data bit, parity bit and stop bit, the data sent by the touch screen serial port controller can be read. The main program flow chart is shown in Figure 3 [3] .

Figure 3 Main program flow chart

4.3 Touch screen and LCD display coordinate conversion and Microwindows programming implementation

This design uses the microwindows 0.90 version. When writing a program, you do not need to care about the underlying driver and directly call the upper-level API. There is no need to write the underlying driver. The method used here is to write a serial port receiving program corresponding to the touch screen in microwindows, and then compare the coordinates of the microwindows window with the coordinate values ​​in the serial port data. If they are within a certain range, a corresponding event is generated [2] . Use an array to receive the data sent from the serial port, and then take out the position information of the touch screen from the array. The coordinate origin and resolution of the touch screen are different, which also needs to be converted. The specific conversion formula is:

We assume the touch screen is as follows: the lower right corner is the origin coordinate (x 1 ,y 1 ), the horizontal axis is the x-axis, the vertical axis is the y-axis, the upper right corner coordinates are (x 1 ,y 2 ), the upper left corner coordinates are (x 2 ,y 2 ), the upper right corner coordinates are (x 2 ,y 1 ), and the resolution is 4096×4096; the coordinate origin of the LCD connected to ARM7 is in the upper left corner, the horizontal axis is the x-axis, the vertical axis is the y-axis, and the resolution is 640×480, then our coordinate conversion formula is:

x LCD =640-[640×(xx 1 )/(x 2 -x 1 )] (4-1)

y LCD =480-[480×(yy 1 )/(y 2 -y 1 )] (4-2)

Since the resolution of the touch screen is 4096×4096, the values ​​of x 2 -x 1 and y 2 -y 1 are both 4096; the coordinate conversion formula is:

X LCD =640-640×z 1 /4096; (4-3)

Y LCD =480-480×z 2 /4096; (4-4)

The coordinates z1 and z2 in the formula are the coordinates of the touch screen. The method of obtaining them is as follows: the array buffer[ ] receives the data sent from the serial port, and we need to extract the useful coordinate information from the array.

x1=buffer[6]; x2=buffer[7]; x3=buffer[3]; x4=buffer[4];

Here we use four 8-bit elements to obtain two 16-bit coordinate information. Then we need to convert the two 8-bit coordinate data into one 16-bit data. The specific conversion is as follows:

y1=x1<<8; y1 |=x2; /*Two 8-bit data shifted to 16-bit data*/

y2=x3<<8; y2 |=x4;

Then y1 and y2 are the coordinate signals of our touch screen. After the conversion, the coordinates of the display and the touch screen correspond to each other. Create a window under microwindows, set its coordinate value and size, and then use the message processing function of microwindows. If the touch range (the corresponding coordinates of the touch screen on the screen) is within the coordinate range of the window, a corresponding event is generated. I am printing a Touched message on the window. When the touch screen is touched outside the window range, the Nottouched message is printed. Write a program to touch the corresponding position on the touch screen, and a new window will be output at the corresponding position on the screen, and the position is relatively accurate. Figure 4-9 shows the touch point response position displayed on the LCD display when the touch screen is touched.

Figure 7 The position of the LCD display when the touch screen is touched

in conclusion

Through debugging and testing, the design requirements are fully met. The innovation of this design is: the touch screen controller of a Shenzhen company is successfully applied to the HMS32C7202 embedded control system. When the other party does not provide the communication protocol and driver, the communication protocol of the controller is analyzed and the driver of ARM is written. The physical conversion relationship between LCD and touch screen is analyzed, and then the upper-level program is written. The relevant calls are made through the API of microwindows to establish a connection between the underlying data and the upper-level graphical interface. Finally, the corresponding event processing and response program is written to complete the operation of ARM by touching the graphical interface of the touch screen. This interface has been applied to the embedded system platform based on Internet network communication developed by me.

References
[1] Hynix Semiconductor Inc. HMS30C7202 ·www.hynix.com
[2] Wu Minghui et al. Development and application of embedded systems based on ARM. People's Posts and Telecommunications Press. 2004.6
[3] Li Zhongqi. Research and implementation of touch screen control in embedded Linux system. Modern Display. 2005.2.19-22 [4] Yang Guangyou et al. Design of touch screen interface for embedded microprocessor ARM7202. Microcomputer Information. 2004.4, 2004.4.75-76

About the author: Wang Hong, male, born in April 1963, senior engineer, Hunan Provincial Education Department Scientific Research Funded Project (03C211), mainly engaged in digital television and embedded system research and development

Keywords:ARM Reference address:Design of interface circuit between ARM HMS30C7202 and touch screen

Previous article:Design and implementation of DC motor speed control system based on ARM
Next article:Design of interface circuit between ARM HMS30C7202 and touch screen

Recommended ReadingLatest update time:2024-11-16 16:46

ARM4412 MMU memory management unit
Because when driving the bare board, it needs to be interrupted Exception MMU MMU is a memory management unit in the CP15 coprocessor, which is embedded in the ARM chip. Its function is to map virtual addresses to physical addresses. Before using the MMU register mechanism, you must first configure the register. The
[Microcontroller]
Learn what arm is in one article
ARM is the abbreviation of Advanced RISC Machines. You can understand that this is the name of a company. It is also correct to think of it as a general term for a type of microprocessor. Not only that, it even represents a technology. ARM is a company that neither produces chips (fabless) nor sells chips (chipless)
[Microcontroller]
Learn what arm is in one article
Application of Dual-Port RAM in ARM and DSP Communication System
  In the post-PC era, due to the rapid development of network technology and integrated circuit technology, it has become possible to use embedded systems for digital signal processing and transmission. In a dual-processor system consisting of ARM and DSP, the embedded system, as the master device, mainly completes da
[Microcontroller]
Application of Dual-Port RAM in ARM and DSP Communication System
Part2_lesson1---Arm family review
Chips (such as 2440, 6410, 210, etc.) contain ARM cores. The instruction structure is related to the ARM core: ARM9 corresponds to the instruction architecture version ARMV4 ARM11 corresponds to the instruction architecture version ARMV6 Cortex A8 corresponds to the instruction architecture
[Microcontroller]
Part2_lesson1---Arm family review
Lesson 008_The first ARM versioning procedure and its extension
Section 001_Auxiliary Line 1_Hardware Knowledge_LED Schematic Diagram When we learn C language, we will write a Hello program. Then when we download ARM program, there should also be a simple program to guide us to get started, and this program is to light up the LED. How do we light up an LED? There are three steps
[Microcontroller]
Lesson 008_The first ARM versioning procedure and its extension
ARM processor power-on/reset operation
The power-on and reset operations of ARM processors are similar. The first instruction is read from the low-end reset vector address 0 of the processor. Since the exception interrupt vectors of ARM processors are arranged continuously, the exception interrupt entry instruction is generally a jump instruction, at least
[Microcontroller]
Development of seismic intensity meter based on IPv6 and ARM9
Using low-power miniature capacitive tri-axial accelerometer as the sensing component, an ARM9-based embedded system with customized Linux as the master control system, and wireless communication technology that complies with the 802.11b standard as the network access method of the instrument, we have developed an SI-
[Microcontroller]
Development of seismic intensity meter based on IPv6 and ARM9
Embedded real-time image processing system based on ARM+FPGA+multi-DSP
Real-time image processing and high-speed data computing require that the system has fast data processing speed, high data throughput and multi-task processing capabilities. At present, most solutions use HPI data transmission to combine ARM and DSP to complete some image processing. The DSP processor only completes
[Microcontroller]
Embedded real-time image processing system based on ARM+FPGA+multi-DSP
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号