Introduction:
There are many types of interfaces for human-computer dialogue, such as display, LED, LCD and LCD with touch screen. The latter is a new technology that has just developed in recent years. It processes sound, image, video, text, animation and other information through computer technology, and establishes certain logical relationships between these information, making it an integrated system that can interactively access and output information. In other words, it can collect, process, integrate and transmit information in a two-way manner based on the wishes of the information publisher and the needs and acceptance habits of the recipient. The touch screen system conforms to the principles of simplicity, economy and efficiency, and has the characteristics of good human-computer interaction, simple and flexible operation and fast input speed. It is combined with the rapidly developing computer network and multimedia technology. Users can retrieve information and analyze data by just touching the screen with their fingers, and can even make immersive and lifelike effects; it is simpler, more intuitive and faster than keyboard input, and has rich and colorful expression capabilities, which is more affinity than any previous media. The
touch screen and 51 single-chip microcomputer interface can make the operation of some small systems more convenient and faster. The most important issue when using a touch screen is to determine the coordinate position, that is, to determine whether the contact position is within the effective area of the key. Since the assembly language of the 51 series microcontroller does not have the rich library functions and logical operation capabilities of other high-level languages, how to use the 51 microcontroller to simply and accurately complete this task has become an urgent problem to be solved in the application.
In actual applications, we use ADS7843 as the controller of the touch screen. There have been many articles published on the principle and working mode of ADS7843, but how to confirm the coordinate position is rarely mentioned. This article only analyzes the problem of coordinate determination as follows.
1 Conversion mode
The conversion accuracy of ADS7843 is 8 bits and 12 bits, which can be accurate to 1/256 and 1/4096 in the X or Y direction. We use the PDA240160 touch display screen of Tsinghua Pengyuan Company, with an outer size of 61.6mm×42.4mm, so there is no need to use 12-bit A/D conversion, and only 8-bit A/D conversion is enough to achieve the required accuracy, that is, the minimum division is 1/256 in the X and Y length directions.
2 Coordinate Determination
The coordinates of the PDA240160 touch screen display are shown in Figure 1.
Among them, (X,Y) is the center coordinate of a chart key, (X',Y') is the coordinate of the lower right corner, and (X",Y") is the coordinate of its upper left corner. When touching the screen, as long as the touch point is within the rectangular area of (X',Y') and (X",Y"), it is considered that the touch is valid. Assuming that the center coordinate (X,Y) of a 32×32 dot matrix icon key is (50,50), then (X',Y') is (35,40), and (X",Y") is (65,60). When touching, as long as the key coordinates obtained are between (X',Y') and (X",Y"), it is considered that the key is touched. However, there are so many values within the key coordinate range. How to process the obtained coordinates? Initially, we adopted the scattered transfer method, but the result was that the program was too lengthy, poorly readable, and poorly portable, and could not be called as a subroutine. After discussion and analysis, we finally adopted the table lookup method.
First, make a coordinate table as shown below (including the two corner coordinates of all keys on the current screen):
Each row in the table represents the two corner coordinates of a key value (it is necessary to call the relevant program to determine the coordinate values of the two corners after placing the icon key), and the last characters 001~n are the signs of each key value (abbreviated as A). This sign is very useful and will be seen in future programs.
3 Program flow chart and program list
The program flow chart is shown in Figure 2:
The subroutine list can be found in the online supplementary version of this journal (www.dpj.com.cn). Among them, XA and YA store the coordinate values after A/D conversion. The program has been debugged and passed. Please verify it.
Conclusion
After repeated tests, it is concluded that each touch key is very sensitive and can respond within the effective area of each icon key. It proves that this idea is simple, easy to understand, and has good portability. It is very valuable in practical application when determining the coordinates of the touch key position.
References
1 Burr-Brown Company. ADS7843 Data Book. 1998
2 He Limin. Single-Chip Microcomputer Application Technology Selection (5). Beijing: Beijing University of Aeronautics and Astronautics Press, 1997
3 Wan Fujun, Pan Songfeng, et al. Single-Chip Microcomputer Principle System Design and Application. Hefei: University of Science and Technology of China Press, 2001
4 Hu Bing, Wu Shengyan, et al. ADS7843 Touch Screen Interface. Foreign Electronic Components. 2002(7): 27~29
Previous article:Intelligent power cabinet based on single chip microcomputer C8051F060
Next article:Realizing Remote Temperature Display Using Single Chip Microcomputer
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
- Footprint and pad differences between BRD board and LIB library and between LIB library
- LoRa and NB-IoT IoT application comparison solution
- Some experience in interpreting Verilog code.pdf
- What does it mean that wiring can be routed here? Can't wiring be routed on every layer?
- MSP430 MCU Common C Language Programming with Chinese Annotations
- Design of non-magnetic water meter based on MSP430FW427
- How to choose between the three types of Uni-Fluke Victory multimeters?
- How to evaluate the stack usage of TI C2000 series microcontroller programs
- Asymmetric dual-core MCU basics and inter-core communication issues
- FPGA_100-day journey_ROM to digital tube display