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.
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
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- DSP generates bin file method
- Leez AI LAN Object Detection
- Capacitors in circuits,,,,,
- [Rewarded Live Broadcast] Recommend "TI mmWave Packaged Antenna Sensor IWR6843" to achieve building industrial sensing simply and efficiently
- Theoretical speed calculation of WiFi protocols
- BQ76930: Design help needed for BQ76930 based BMS
- Application of the concepts of virtual short and virtual disconnect in operational amplifiers in actual product circuits
- What is the application of PWM
- Guess the questions in the electronic competition and win prizes!
- MSP430f5529