Interrupt Control Method of Touch Screen in ARM Embedded System

Publisher:RadiantRiverLatest update time:2010-07-01 Source: 单片机Keywords:ARM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

With the improvement of embedded microprocessor performance, more and more peripheral interface devices are integrated, and the peripheral devices and processors mostly communicate in the form of interrupts. Even in the absence of an operating system, it is often necessary to dynamically load the interrupt processing routines of multiple peripheral devices, thereby realizing centralized dynamic management of multiple peripheral devices. At the same time, the interrupt function can solve the waiting delay problem caused by the CPU's internal running speed being much faster than the external bus speed. Therefore, in the application design of embedded microprocessors, interrupt processing is usually one of the core tasks of the system.

1 Touch screen

(1) Touch screen introduction

With the increasing number of multimedia information queries, people are paying more and more attention to touch screens. Touch screens have many advantages such as durability, fast response, space saving, and easy communication. As a new computer input device, it is currently the simplest, most convenient, and natural way of human-computer interaction. It gives multimedia a new look and is a very attractive new multimedia interactive device. The touch screen consists of a touch detection component and a touch screen controller. The touch detection component is installed in front of the display screen to detect the user's touch position and send the received information to the touch screen controller; the main function of the touch screen controller is to receive touch information from the touch point detection device, convert it into touch point coordinates and send it to the CPU, and at the same time receive commands from the CPU and execute them. According to the working principle of the touch screen and the medium for transmitting information, the touch screen can be divided into four types, namely resistive, capacitive induction, infrared, and surface acoustic wave. The four-wire resistive screen is used here.

(2) S3C2410A touch screen controller

The external circuit of the S3C2410A touch screen is mainly used to control the on/off status of the upper and lower conductive layers and to obtain voltage. After obtaining the voltage, the analog quantity needs to be converted into a digital quantity. This part of the work is mainly achieved by the analog-to-digital converter in the S3C2410A chip. That is, the function of the touch screen is actually divided into two parts, namely the external circuit part of the touch screen and the A/D conversion control part of the S3C2410A chip.

2 ARM embedded operating system interrupt processing method

In embedded systems, the functions of external devices are mainly realized by interrupt mechanisms. Therefore, ARM, as a typical representative of embedded microprocessors, has established a complete set of exception handling mechanisms to ensure the real-time performance and stability of the system.

2.1 S3C2410A interrupt register

Each register plays a different role in the interrupt handling process. The interrupt process is shown in Figure 1.

2.2 Interrupts and Interrupt Service Routines

The hardware logic of the interrupt will point the detected interrupt to the address of the interrupt service routine in some way. This address appears in the header file as a macro definition. In your own program, the user assigns the address of the interrupt service routine to this pointer, thereby linking the interrupt with the interrupt service routine.

In order to facilitate the use of high-level languages ​​to write exception handling functions, the ARM compiler has made specific extensions to the exception handling functions. As long as the keyword __irq is used, the compiled function will meet the needs of exception response for scene protection and recovery.

In the ADS compiler, __irq is used to declare an IRQ interrupt service routine. If __irq is used to declare a function, then the function is an IRQ interrupt service routine, and the compiler will automatically add interrupt context protection code inside the function. [page]

3. Interrupt mode to realize touch screen drive

3.1 Setting and enabling interrupt registers

The touch screen of S3C2410A is an internal interrupt with interrupt. When an interrupt occurs, the corresponding position of SUBSRCPND is set to 1. If it is not masked by INTSUBMSK, then the corresponding position of SRCPND is set to 1. If it is not masked by INTMSK, INTMOD is further set. Here, the IRQ interrupt mode is adopted, so SRCPND can have multiple positions set to 1 (FIQ can only have 1 bit). After PRIORITY, a high priority is selected, and then the corresponding position of INTPND is set to 1 (only 1 bit can be selected), and then enter IRQ for CPU processing.

First, we must clarify the relationship between SUBSRCPND and SRCPND. Several SUBSRCPNDs may correspond to the same SRCPND. After continuous summarization, the corresponding relationship is listed in Table 1. From the table, we can see that the touch screen needs to use the INT_TC bit in SUBSRCPND, that is, SUBSRCPND[9]. Here we define the variables:

#define BIT_SUB_TC(0x1<<9)

The corresponding bit is the INT_ADC bit in SRCPND, that is, SRCPND[31], and the variable is defined:

#define BIT_ADC(0xl<<31)

INTMOD and PRIORITY use the default settings. Therefore, the touch screen interrupt process can be written as:

3.2 Touch screen interrupt and touch screen interrupt program

First, enable the interrupt vector of the ARM chip. When an IRQ interrupt comes, the CPU will automatically fetch instructions at address 0x18. The instruction at 0x18 is calculated by the CPU according to the interrupt source. Here, the touch screen interrupt INT-ADC comes, so the instruction at 0x18 is to jump to address 0x9c. Then execute the instruction "ldr pc, = HandlerINT_ADC". The result of executing this instruction is to jump to "HandlerINT_ADC" for execution.

So what is the instruction at "HandlerINT_ADC"? From the memory location of accessing the absolute address "#define pISR_ADC(*(unsigned*)(ISR_STARTADDRESS+0x9c))", we can know that the address at "HandlerINT_ADC" is _ISR_STARTADDRESS+0x9C. [page]

The above statement converts the unsigned integer _ISR_STARTADDRESS+0x9c into a pointer pointing to RAM, which is accessed through the statement "pISR_ADC=(int)touchscreen;". touchscreen is the defined touch screen interrupt program, and the interrupt service program must be declared using the "__irq" keyword. In this way, the user assigns the address of the interrupt service program to the pointer in his own program, thereby linking the touch screen interrupt with the touch screen interrupt program. The connection between the entire touch screen interrupt and the touch screen interrupt program is shown in Figure 2.

Conclusion

This article completes the setting of the touch screen related interrupt registers, and writes the touch screen interrupt handler, and uses the method of writing the "__irq" function to realize the touch screen control based on interrupts. In practical applications, the program design is simple and reliable, the touch point coordinates are read accurately, and there is no sticking phenomenon, achieving the expected effect.

Keywords:ARM Reference address:Interrupt Control Method of Touch Screen in ARM Embedded System

Previous article:High-speed power calculation based on CS5463 electric energy measurement circuit
Next article:Design of an electronic scale system based on a single-chip solution

Recommended ReadingLatest update time:2024-11-17 00:46

ARM LCD and LCD controller
Since we mentioned LCD, the first thing we must understand is its types. CD (liquid crystal display) is a display that uses liquid crystal to control transmittance counting to achieve color. Compared with traditional CRT displays, it has many advantages: light and thin, low energy consumption, low radiation, etc., and
[Microcontroller]
ARM LCD and LCD controller
Building an ARM development environment based on ADS+J-Link under Windows
In general ARM programming teaching and experimental environments, the development environment of ADS plus parallel port to Jtag board + H-Jtag is generally used. But the biggest disadvantage of this method is that it requires a parallel port on the machine. Nowadays, it is difficult for both PCs and laptops to have p
[Microcontroller]
The beginning of learning ARM assembly instructions
Instruction set learning   1. ARM Instruction Set     1. Instruction format     2. Condition Code     3. ARM Memory access instructions     1) LDR/ STR - Load/Store Instructions     2) LDM/STM - Multiple register load/store instructions     3) SWP - Register and memory e
[Microcontroller]
ARM development step by step to master ADC and touch screen
Experimental purpose: Display the input voltage value through the serial port and collect the (x, y) coordinate value of the touch screen to master the use of S3C2410 ADC and touch screen. Experimental environment and instructions: Hengyi S3C2410 development board H2410. The AIN0~AIN1 outputs on the H24X0E expansion
[Microcontroller]
Audio decoder single chip system based on ARM core
Introduction The EP7209 is the world's first digital audio decoder system-on-chip that supports both the popular MP3 standard and rapidly emerging Internet audio compression standards such as Microsoft Audio. When running at 74MHz, the performance of the EP7209 is equivalent to that of a personal computer base
[Microcontroller]
Audio decoder single chip system based on ARM core
Design of intelligent trip device data acquisition system based on ARM microcontroller
introduction In the process of generating, transmitting and using electric energy, power distribution is an extremely important link. Low-voltage circuit breaker is an electrical appliance used in low-voltage power distribution system to handle serious overload, short circuit, overvoltage, undervoltage, overcurrent, r
[Microcontroller]
Design of intelligent trip device data acquisition system based on ARM microcontroller
ARM boot process
Most ARM-based chips are complex on-chip systems. Most hardware modules in such complex systems are configurable and need to be set to their required working states by software. Therefore, before the user's application program, a special piece of code is required to complete the initialization of the system. Since this
[Microcontroller]
ARM Knowledge--"Some Problems with ARM and Linux" Chapter 1: ARM Working Mode
=====================================================     Early ARM cores had state (ARM or Thumb) switching (using BX and other instructions to modify the T control bit in the CPSR register (current program status register, which stores condition code flags, interrupt disable bits, current processor mode, and other s
[Microcontroller]
Latest Test Measurement Articles
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号