Design of touch screen interactive function module based on embedded system

Publisher:敬亭山人Latest update time:2012-12-29 Source: dzsc Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction

Embedded systems have shortened the distance between people and computers, forming a harmonious working and living environment for humans and machines. From a certain perspective, touch screens, as integrated input and output devices in embedded computer systems, have been widely used in manufacturing industry, process control, communications, instruments, meters, automobiles, ships, aviation, aerospace, military equipment, consumer products, etc., affecting all areas of human work and life and having great application prospects. The programming of its interactive function with embedded systems is the key to the entire system design. This article describes such a design process and gives a detailed explanation of the technical issues involved. The functional design is based on the S3C2410 chip with ARM920T core, with the GX development board as the hardware platform, and is a graphic and text interactive interface module implemented with Windows CE as the operating system.

2 Design of system interaction functions

2.1 System Architecture

Usually the architecture of embedded systems can be divided into four parts: processor, memory, input and output (I/O) and software. Since the application software and operating system of most embedded devices are closely integrated, we do not distinguish them here, which is also the biggest difference between embedded systems and general PC systems. See Figure 1 for the block diagram of touch screen embedded design.


Figure 1 Touch screen embedded design block diagram

2.2 Main functions of Windows CE

It is a newly developed modular multi-tasking operating system with a graphical user interface. It is a high-performance, high-efficiency real-time operating system that supports multiple CPUs and has good communication capabilities. OEM manufacturers can add any modules they need or remove unnecessary ones. The failure of an application in the system will not cause the entire system to fail.

2.3 Operating system support for touch screen

The operating system supports touch screens in a layered manner. First, there is the application layer, where the written application calls the touch screen/mouse event API (there are related API functions in the traction layer); second, there is a driver that supports the touch screen in the driver layer. The touch screen device driver of the operating system kernel is called through a unified interface to complete the final device control. The actual coordinate value of the touch screen is taken out and recorded in the initialization program. The next time an application needs to call the touch screen driver, the touch screen driver will check the initialization program, read the correction value, and return the relative coordinate value after correction and mapping to the application.

2.4 Touch screen circuit

The GX development board is a hardware platform with an onboard SHARP 3.5" TFT LCD screen LQ035Q7DB02, 320×240, 262,144 colors, White LED backlight, and touch screen. The SHARP LCD has its own four-wire resistive touch screen, which can be directly connected to the 2410 touch screen driver circuit. The touch position is directly sampled by the CPU's built-in ADC circuit.


Figure 2 Onboard touch screen circuit

2.5 Touch screen control circuit

The touch screen is controlled by the FM7843 chip. The FM7843 is a 4-wire resistive touch screen conversion interface chip. It has 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 the off mode is only 0.5μW. Therefore, the ADS7843 is widely used in small battery-powered handheld devices with its low power consumption and high speed. The FM7843 adopts the SSOP-16 pin package with a temperature range of -40~85℃. In order to complete an electrode voltage switching and A/D conversion, it is necessary to first send a control word to the FM 7843 through the serial port, and then read the voltage conversion value through the serial port after the conversion is completed. A standard conversion requires 24 clock cycles. Since the serial port supports bidirectional transmission at the same time, and the reading can overlap with the next control word, the conversion rate can be increased to 16 clock cycles each time. If conditions permit, and the CPU can generate 15 CLKs (such as FPGAs and ASICs), the conversion rate can be increased to 15 clock cycles each time. FM 7843 communicates with ARM through the synchronous serial port. Data can be sent to FM 7843 through the SendSIOData() function (uhal.c); data can be read from FM 7843 through the ReadSIOData() function (uhal.c). FM7843 can be turned on and off by setting the 6th position of the F port to 0 and 1. The data register of the F port is PDATF (44b.h). Whether there is a touch action can be determined through external interrupt 5. The query method is to determine whether there is a touch action through the macro TCHSCR_IsPenNotDown() (tchscr.h).

3 Key issues in design

3.1 Customizing the Windows CE Platform

Windows CE is a multi-platform, scalable 32-bit embedded operating system. It is suitable for embedded intelligent control modules of industrial equipment and the development of consumer electronic products. According to different target device hardware environments, various modules are added to its kernel to form a customized embedded operating system. It includes everything needed for customized devices, such as networking capabilities, real-time performance, small memory usage, multimedia and web browsing functions, etc. [page]

3.2 Driver Mode of Windows CE

There are two forms of driver models for Windows CE devices: Stream Interface Driver and Native Device Driver. From the perspective of implementation, both types of drivers can be used in single-layer and layered modes. The code implemented in the multi-layer device driver is divided into two layers: MDD (Model Device Driver) and PDD (Platform. Dependent Driver). The MDD layer provides the GWES module with a DDI (Device Driver Interface) function interface, which implements the common functions of drivers for the same type of device, while PDD implements the code related to the specific hardware devices of the platform. MDD accesses the hardware by calling special PDD functions.

3.3 Touch screen and display coordination algorithm

The X and Y values ​​sent back to the controller by FM 7843 are only the A/D conversion values ​​of the voltage value of the current touch point, which has no practical value. The size of this value is not only related to the resolution of the touch screen, but also to the fit between the touch screen and the LCD. Moreover, the resolution of the LCD and the resolution of the touch screen are generally different, and the coordinates are also different. Therefore, if you want to get the touch screen position that reflects the LCD coordinates, you need to convert it in the program. The conversion formula is as follows:

x=(x-TchScr_Xmin)*LCDWIDTH/(TchScr_Xmax-TchScr_Xmin)

y=(y-TchScr_Ymin)*LCDHEIGHT/(TchScr_Ymax-TchScr_Ymin)

Among them, TchScr_Xmax, TchScr_Xmin, TchScr_Ymax and TchScr_Ymin are the range of the touch screen return voltage value x and y axis, LCDWIDTH and LCDHEIGHT are the width and height of the LCD screen.

3.4 Operating System Support for Touch Screen

The operating system supports touch screens in a layered manner. First, there is the application layer, where the written application calls the touch screen/mouse event API (there are related API functions in the traction layer); second, there is a driver that supports the touch screen in the driver layer. The touch screen device driver of the operating system kernel is called through a unified interface to complete the final device control. The actual coordinate value of the touch screen is taken out and recorded in the initialization program. The next time an application needs to call the touch screen driver, the touch screen driver will check the initialization program, read the correction value, and return the relative coordinate value after correction and mapping to the application.

3.5 Confirmation of touch screen coordinates

The coordinates collected in the above way are relative to the touch screen coordinates and need to be converted into LCD coordinates. Before this process, two coordinate calibrations need to be performed. Here, the average method is used. First, two maximum values ​​and two minimum values ​​are obtained from the four vertex corners of the touch screen, which are recorded as x_min, y_min and x_max, y_max respectively. The determination of the X and Y directions is shown in Table 1.


Table 1 Determination of X, Y directions

When the system is in sleep mode, Q1, Q3 and Q4 are in the off state, and Q2 is on. When the touch screen is pressed, MOS tube groups Q1 and Q4 are turned on first, and +3.3V power is added to the X+ and X- circuits. At the same time, MOS tube groups Q2 and Q3 are turned off, Y+ and Y- are disconnected, and then the processor's A/D conversion channel 1 (AIN1) is started. The circuit resistance and the resistance generated by pressing the touch screen output component voltage, and the A/D converter digitizes the voltage value to calculate the coordinate of the X axis. Then, MOS tube groups Q2 and Q3 are turned on first, and +3.3V power is added to the Y+ and Y- circuits. At the same time, MOS tube groups Q1 and Q4 are turned off, X+ and X- are disconnected, and then the processor's A/D conversion channel 0 (AIN0) is started. The circuit resistance and the resistance generated by pressing the touch screen output component voltage, and the A/D converter digitizes the voltage value to calculate the coordinate of the Y axis. After the system reads the coordinate values, it turns off Q1, Q3, and Q4, turns on Q2, returns to the initial state, and waits for the next stroke.

After determining the X and Y directions, the coordinate value calculation formula is as follows:

X=(x_max-Xa)×320/(x_max-x_min)

Y=(y_max-Ya)×240/(y_max-y_min)

Where:

Xa=(X1+X2+....+Xn)/n

Ya=(Y1+Y2+....+Yn)/n

Generally, the touch screen sends the voltage values ​​of the X and Y directions when touched to the A/D conversion interface. The X and Y values ​​after A/D conversion are only the A/D conversion values ​​of the voltage values ​​of the current touch point, which have no practical value. The size of this value is not only related to the resolution of the touch screen, but also to the fit between the touch screen and the LCD. If you want to get the touch screen position that reflects the LCD coordinates, you still need to convert it in the program.

4 Conclusion

More and more PDAs in embedded systems use touch screens as input and output devices. This paper uses the S3C2410 chip GX development board with ARM920T core as the hardware platform to design an embedded system touch screen interactive function module, which has been used many times in products and works of the National Undergraduate Embedded System Competition. The paper also makes a detailed analysis and discussion of the key technical issues in the design. The software design flow chart, source code and other auxiliary programs are introduced in another article due to space limitations.

References:

[1]. ARM920T datasheet http://www.dzsc.com/datasheet/ARM920T_139814.html.
[2]. PC datasheet http://www.dzsc.com/datasheet/PC+_2043275.html.
[3]. LQ035Q7DB02 datasheet http://www.dzsc.com/datasheet/.html.
[4]. ADS7843 datasheet http://www.dzsc.com/datasheet/ADS7843_1055179.html.
[5]. SSOP-16 datasheet http:/ /www.dzsc.com/datasheet/SSOP-16_623709.html.

Reference address:Design of touch screen interactive function module based on embedded system

Previous article:Design of Embedded Video Monitoring System Based on B/S Mode
Next article:Design and Implementation of Embedded Modbus/TCP Gateway

Recommended ReadingLatest update time:2024-11-16 15:20

Porting Embedded Linux to ARM Processor S3C2410: Application Example
The writing of application examples actually does not fall within the scope of Linux operating system porting, but in order to ensure the completeness of this series of articles, a series of examples of developing applications for embedded Linux are provided here.   The following tools are used to write Linux applicat
[Microcontroller]
S3C2410 Memory Management Unit
MMU, full name Memory Manage Unit, Chinese name - memory management unit.     Many years ago, when people were still using DOS or older operating systems, computer memory was very small, generally calculated in K units. Correspondingly, the program size at that time was not large, so although the memory capacity was s
[Microcontroller]
S3C2410 Memory Management Unit
S3C2410 Interrupt Register
S3C2410 has 24 external interrupt pins: EINT0~EINT23, but for the four external interrupts EINT0~EINT3, the use is relatively simple; for the other 20, the use is slightly more complicated. First, let's look at the interrupt controller of S3C2410. There are 6 interrupt arbiters divided into 2 levels, 5 in the first
[Microcontroller]
arm-linux-gcc4.4.3 compiles the s3c2410 platform linux kernel
1. First download the linux kernel: linux-2.6.14.tar.bz2 Download address: http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.14.tar.bz2 2. Unzip linux-2.6.14.tar.bz2: tar -jxvf linux-2.6.14.tar.bz2 3. Configure the Makefile: 1. Open the Makefile in the source code root directory: gedit Makefile Modify the Makefil
[Microcontroller]
Development of Linux Driver Based on S3C2410
1. Establishment of development environment In embedded systems, due to the limited resources of the target machine, the driver and application are usually compiled on the host, and then communicate with the target machine through serial port, Ethernet, emulator or other communication means. In order to facilitate the
[Microcontroller]
The transplantation process of Linux operating system on S3C2410 development board
The integration of ARM9S3C2410 microprocessor and Linux is getting closer and closer, and it is gradually being widely used in the embedded field. Currently, the combination of S3C2410 and Linux can be seen in portable consumer electronics, wireless devices, automobiles, networks, storage products, etc. The S3C2410
[Microcontroller]
The transplantation process of Linux operating system on S3C2410 development board
ucOS-II ported to S3C2410 Notes 1
1: Problem: I transplanted the assembly function: OSStartHighRdy, as shown below, but found that it could not run correctly when there was only one task, OS_TaskIdle.  .globl OSStartHighRdy    .type OSStartHighRdy, %function  OSStartHighRdy:        /* C variable OSRunning = TRUE */          mov r0, #1      ldr
[Microcontroller]
SD storage technology and its application based on S3C2410
Abstract: This paper first introduces the basic structure and principle of SD Memory Card (Secure Digital Memory Card), focusing on the command words and operation flow of SD card. Then it studies the hardware interface circuit between Samsung 32-bit embedded processor S3C2410 and SD card and its basic reading and w
[Industrial Control]
SD storage technology and its application based on S3C2410
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号