Embedded Development (S5PV210) - ADC and Touch Screen

Publisher:WhisperingHeartLatest update time:2022-08-02 Source: csdn Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. ADC Introduction

ADC (analog digital converter) is AD conversion, which converts analog quantity into digital quantity. The CPU itself is digital and discrete, while the external world is analog and continuous, so the external information cannot be directly processed by the computer, and the analog quantity must be converted into digital quantity first. The current CPU is binary, and the data is represented by n-bit binary. However, in real life, physical quantities such as time, voltage, and height are continuously distributed, and there are countless numbers between 0 and 1. If mathematics is used to describe the current physical quantity, it may require infinite decimal places. Obviously, it is impossible for a computer to store this physical quantity with infinite binary bits, so there is the precision of measurement. Using finite-bit binary to represent the current physical quantity will lose a certain amount of precision and cannot be 100% true, but this deviation is acceptable. The ADC represents the current physical quantity in reality with a finite number of binary bits according to the precision, so that the CPU can perform calculations. (Here I suddenly feel that there is an interesting sentence: precision means loss. I used to think that precision was a very cool word, and precision instruments were all claimed to reach a certain precision. Now I think that the real instruments do not use the concept of precision at all. In real life, the amount is what is measured.)

Supplement: Generally, ADC converts voltage signals, converting analog electrical signals into digital electrical signals through sampling. This requires the participation of various sensors. Different sensors convert different physical quantities into voltage signals. For example, photoelectric sensors have different voltages corresponding to different light intensity. By measuring the voltage, we can know the current light intensity.


2. Main concepts of ADC

2.1. Range

ADC is an electronic device used for voltage conversion. It has physical characteristics and has a range requirement for the input analog voltage. The analog voltage at the AD input terminal requires a range, generally 0-3.3V or 0-5V or 0-12V, etc. The analog voltage range is a parameter of the AD chip itself. The voltage signal given to the AD during actual operation cannot exceed this voltage range.


2.2 Accuracy

The digital value obtained by AD conversion is represented by a certain number of bits in binary. Common ADCs are 10-bit and 12-bit. Under the same range, the higher the number of bits, the more accurate the ADC is (it is not simply the more bits, the more accurate it is, it also depends on the range). For example, if the ADC range is 0~3.3V, a 10-bit ADC can be accurate to 3.3/1024, while a 12-bit ADC can be accurate to 3.3/4096.


2.3 Conversion rate

1. ADC is a physical device. It takes time for AD chips to perform AD conversion. How long this time takes varies from chip to chip. The conversion time of the same chip is also different when the configuration is different (for example, the accuracy configuration

The time for 10 bits is shorter than when the accuracy is configured as 12 bits. For example, some ADs can be equipped with conversion clocks, and the higher the clock frequency, the shorter the conversion time).

2. The unit used to describe the conversion rate in the data sheet is MSPS (the first M stands for mega, S stands for sample, and PS stands for per second, which generally means megasamples per second, or how many M digital values ​​are converted per second). Clock frequency and MSPS are different concepts. For example, the S5PV210 chip requires 5 clocks to convert once, so MSPS = clock frequency/5.


2.4 Number of channels

The number of analog input channels of an AD chip represents how many analog signals can be input simultaneously in the future.


3. S5PV210 ADC controller

3.1、ADC working clock block diagram

insert image description here

>From the clock block diagram, we can know that the ADC clock ADCCLK is obtained by dividing the upper clock PCLK (PCLK_PSYS), and the division coefficient is controlled by bit6~bit13 of the TSADCCONn register. In the future, the ADC clock will be configured by configuring bit6~bit13 of the TSADCCONn register. Pay attention to the ADCCLK obtained by frequency division not to exceed the range.


3.2. Number of channels supported by ADC

insert image description here
insert image description here

From the figure, we can see that the Soc supports 10 ADCs. Combined with the data sheet, we can see that 2 of them are dedicated to AD conversion, and the remaining 8 can support 2 resistive touch screens (a resistive touch screen requires 4 ADs). In the I/O description table, the value of the last field type is Analog, which means that this pin is an analog pin. The pins of the Soc can be divided into digital pins and analog pins. Digital signals only receive digital signals, and the states are only 0 and 1; analog pins can input analog signals. The analog pins used for AD conversion can input analog signals, and then the ADC converts them into digital signals.


3.3 Main registers of ADC controller

TSADCCON0: frequency division coefficient, accuracy, whether to use interrupt mode, etc.

TSDATX0 & TSDATY0: The transferred AD value is stored here, and we also read it here

CLRINTADC0: clear interrupt

ADCMUX: Select the AD channel currently being operated


3.4. Method of waiting for touch screen conversion to complete

1. Check the flag bit: Use polling to start a conversion and then check the flag bit repeatedly until the flag bit is 1, indicating that the conversion is complete and can be read.

2. Interrupt: Set up the interrupt and write the interrupt handler isr to read the AD conversion data.


3.5. Two ways to start AD conversion

1. Manual start: Each time after reading the data, you need to manually set the AD conversion start position to 1;

2. Start by read mode: After reading the data, Soc will automatically start the next AD conversion.

Supplement: Both modes can be configured in the TSADCCON register.


4. Touch screen

4.1. Relationship between touch screen and display screen

The touch screen and the display are two devices. The touch screen responds to touch events, and the display displays images. Nowadays, the touch screen and the display are often made together. The touch screen is transparent and thin on the outside, and the bottom layer is the display.

The image you see is displayed on the display and is seen through the touch screen, but because the touch screen is transparent, it is not easy to feel the presence of the touch screen.


4.2 Resistive touch screen

Squeezing produces deformation and then changes the resistance, and the coordinates are calculated by measuring the voltage change. Resistive touch screens are often associated with ADC. The pins of the resistive touch screen are connected to the AD pins of the Soc, and the voltage value is obtained through AD conversion, and then the coordinates are calculated through X/Y axis time-sharing AD conversion.

**X/Y axis time-sharing AD conversion: **Apply voltage to the two pairs of electrodes of the resistive touch screen respectively, and calculate the coordinates of the X-axis and Y-axis twice.


4.3 Capacitive touch screen

1. Principle: Using the current induction phenomenon of the human body, a capacitor is formed between the finger and the screen. When the finger touches the screen, a small current is absorbed. This current causes current to flow on the four electrodes on the touchpad. The controller can calculate the coordinates of the touch point by calculating the ratio of these four currents (this calculation process involves AD conversion).

2. Coordinate calculation: This coordinate calculation is more complicated than that of the resistive touch screen. There is an IC chip specifically responsible for the calculation. The Soc communicates with the touch screen through the I2C interface.


4.4 Touch screen hardware interface

1.SoC has built-in touch screen controller;

2. An external dedicated touch screen control chip connects the touch panel sensor to this control chip.

The internal logic circuit or built-in program code can calculate the touch point coordinates according to the above principle and convert them into digital quantities and send them to the host Soc through the I2C interface.

Note: Resistive touch screens can be any of the two hardware interfaces above; capacitive touch screens are currently external dedicated touch screen control chips.


4.5. How to distinguish between resistive touch screen and capacitive touch screen

In terms of time, the resistive touch screen appeared first and then the capacitive touch screen. Now most electronic products that interact with people use capacitive touch screens. Resistive touch screens are also used in industry. I still remember that my first mobile phone was a resistive touch screen. The phone also came with a small stick, which was used to operate the screen. You had to scratch it with your fingernail to write. Nowadays, all mobile phones have capacitive touch screens, which are much better than resistive touch screens, but the screen is not very sensitive when it is wet.


Summary: Use a sharp object (such as a small stick) to touch the screen, and it will respond if it is a resistive touch screen. Although this method cannot guarantee 100% accuracy, it is convenient, fast and almost always correct.

Reference address:Embedded Development (S5PV210) - ADC and Touch Screen

Previous article:Embedded Development (S5PV210) - LCD Display
Next article:ARM chip learning (S5PV210 development) - code relocation

Latest Microcontroller 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号