Share this

Touch screens and their control in embedded systems

2026-04-06 07:21:52 · · #1
In portable electronic products, touchscreens have gradually replaced keyboards as input devices for embedded computer systems due to their advantages such as portability, small footprint, and flexibility. A touchscreen-based input system actually consists of a touchscreen, a touchscreen controller, a microcontroller, and corresponding software. This article starts with the hardware composition of the system, analyzing the hardware and software principles and implementation methods of the entire system. I. System Composition Principles The touchscreen input system consists of three parts: the touchscreen, the touchscreen controller, and the microcontroller. Figure 1 shows an actual touchscreen input system. In this system, the touchscreen uses a four-wire resistive touchscreen from Truly Technology, the touchscreen controller uses BB's ADS7846, and the microcontroller is a Motorola M·CORE series MMC2107. Figure 1: Composition of the touchscreen input system Figure 2: Touchscreen schematic diagram 1. Touchscreen Principles The touchscreen is attached to the surface of the display and works in conjunction with the display. If the coordinates of the touch point on the screen can be measured, the user's intention can be determined from the content or symbols displayed at the corresponding coordinates on the screen. Touchscreens can be classified into five types according to their technical principles: vector pressure sensing, resistive, capacitive, infrared, and surface acoustic wave (SAW) touchscreens. Resistive touchscreens are more commonly used in embedded systems. A resistive touchscreen is a four-layer transparent composite film screen, as shown in Figure 2. The bottom layer is a base layer made of glass or acrylic glass; the top layer is a plastic layer with a hardened outer surface for smoothness and scratch resistance; and the middle layers are two conductive metal layers, one on top of the base layer and the other on the inner surface of the plastic layer. Numerous tiny transparent insulating points separate the two conductive layers. When a finger touches the screen, the two conductive layers make contact at the touch point. The two conductive metal layers of the touchscreen are the two working surfaces. Each working surface has a strip of silver paste applied to each end, forming a pair of electrodes. If a voltage is applied to the electrode pair on one working surface, a uniform and continuous parallel voltage distribution will be formed on that surface. As shown in Figure 1, when a specific voltage is applied to the electrode pair in the X direction, while no voltage is applied to the electrode pair in the Y direction, the voltage value at the touch point can be reflected on the Y+ (or Y-) electrode in the X parallel voltage field. By measuring the voltage of the Y+ electrode to ground, the X coordinate value of the touch point can be determined. Similarly, when a voltage is applied to the Y electrode pair, while no voltage is applied to the X electrode pair, the Y coordinate of the touch point can be determined by measuring the voltage of the X+ electrode. Resistive touchscreens come in four-wire and five-wire types. In a four-wire touchscreen, the X and Y working surfaces are respectively applied to two conductive layers, with a total of four leads connected to the X and Y electrode pairs of the touchscreen. In a five-wire touchscreen, both the X and Y working surfaces are applied to the conductive coating of the glass substrate, but during operation, the voltage is applied time-division multiple times, meaning the voltage fields in the two directions work on the same working surface at different times, while the outer conductive layer only serves as a conductor and voltage measuring electrode. Therefore, a five-wire touchscreen requires five leads. 2. Working Principle of ADS7846 Touchscreen Controller Various types of touchscreens have their corresponding controllers. For example, the ADS7846 is a controller for four-wire touchscreens, while the ADS7845 is a controller for five-wire touchscreens. The main function of the controller is to apply voltage to the X and Y electrode pairs in a time-division multiplexing manner and convert the voltage signals on the measuring electrodes into the X and Y coordinates of the corresponding touch point. 1) Operating Principle: The ADS7846 internally contains a power supply-measurement circuit network composed of multiple analog switches and a 12-bit A/D converter (see Figure 3). The ADS7846 activates different analog switches according to different measurement commands sent by the microcontroller to provide voltage to the working surface electrode pairs and introduces the analog voltage corresponding to the touch point coordinates on the corresponding measuring electrodes into the A/D converter. During the measurement of the X and Y coordinates of the touch point, the equivalent circuit of the measured voltage and the measured point is shown in Figure 4, where P is the measured point. Figure 3 Functional block diagram of ADS7846 Figure 4 Measurement relationship 2). Digital interface: ADS7846 and MMC2107 are connected via a standard SPI port. The conversion is completed by MMC2107 initiating three SPI transmissions, as shown in Figure 5. The first SPI transmission is a control word sent by MMC2107 to ADS7846, including start bit, channel selection, 8/12-bit mode, differential/single-ended selection, and power-down mode selection. The next two SPI transmissions are for MMC2107 to retrieve the A/D conversion result data from ADS7846 (the last four bits are automatically padded with zeros), completing one communication between the touch screen controller and the microcontroller. Figure 5 Conversion timing diagram 6 Pen interrupt request 3). Pen interrupt (PENIRQ#) output: ADS7846 indicates to MMC2107 that a touch has occurred through a pen interrupt request. As shown in Figure 6, when there is no touch, MOSFETs ① and ② are turned on, and ③ is turned off. The pen interrupt output pin is high through an external pull-up resistor. When there is a touch, pins ① and ③ are turned on, and pin ② is turned off. The pen interrupt output pin is then connected to ground internally via pin ③, resulting in a low output and triggering an interrupt request to the MMC2107. II. Practical Application Example The hardware wiring of the touchscreen input system is shown in Figure 1. When there is a touch, the ADS7846 sends an interrupt request to the MMC2107. The MMC2107 responds to this interrupt request, initiating the communication process shown in Figure 5, reading the conversion result from the ADS7846, and thus obtaining the coordinates of the touch point. Its software interface is shown in Figure 7, including system initialization (omitted in the figure), interrupt service routine, and the ADS7846 measurement program. In the ADS7846 measurement program, a communication process between the MMC2107 and ADS7846 is completed. During the measurement process, it was found that an external clock frequency of 50kHz to 60kHz is suitable for the ADS7846. The ADS7846 can only be used as a slave device in SPI, and the timing of each signal is completely fixed. Therefore, the timing of the MMC2107 SPI interface signals needs to be configured to fully conform to the timing of the ADS7846, especially the slave select signal SS#, which should remain low throughout a single communication (see Figure 5). Figure 7 shows the software interface flowchart. The actual measurement results are shown in Tables 1 and 2: Table 1 shows the coordinate values ​​of several points measured at equal intervals on a basically vertical straight line. From the table, we can see that the slope of the X coordinate is 64.25/mm. Table 2 shows the coordinate values ​​of several points measured at equal intervals on a basically horizontal straight line. We can see that the slope of the Y coordinate is 46.33/mm.
Read next

CATDOLL Cici Hard Silicone Head

The head made from hard silicone does not have a usable oral cavity. You can choose the skin tone, eye color, and wig, ...

Articles 2026-02-22