12.1 AD brief description
Before introducing ADC, let us first talk about the fields in which ADC is generally applied. For example, it is widely used in wireless communications, software defined radio, data acquisition, optical communications, instrumentation and other fields. To give a very simple example, if you want to obtain the power consumption of battery voltage, you need to use ADC. Of course, there are many types of ADCs, which I won’t go into here. You can check them online. Take a look and learn more.
In fact, most of the quantities that exist in nature are analog quantities, such as temperature and humidity, time, speed, pressure, flow, etc., but, brothers, when we use these things, we need to use a computer to convert them into digital quantities. , so that some control can be carried out more effectively.
Therefore, a bridge is needed between them, and this bridge is ADC and DAC. This chapter only introduces ADC, DAC will be introduced in the next chapter.
A typical digital control system flow diagram is shown below:
According to the information in the figure, we can know that non-electrical analog quantities need to use specific sensors to convert analog signals into electrical signals, and then use ADC to convert the electrical signals into digital signals. After being processed by the embedded system, the digital signals are then converted into digital signals through DAC. into analog signals to control the actuator.
12.1.1 Brief introduction to ADC
Let's first talk about the conversion process of ADC, and then talk about the principle. Of course, if you find it too verbose, you can skip it directly.
ADC is the English abbreviation of Analog-to-Digital Converter, which translates as analog-to-digital converter. It refers to a device that converts continuously changing analog signals into discrete digital signals. The function of A/D conversion is to convert analog signals that are continuous in time and continuous in amplitude into digital signals that are discrete in time and discrete in value. Therefore, A/D conversion generally goes through four processes: sampling, holding, quantization and encoding. As shown below. In actual circuits, some of these processes are combined. For example, sample and hold, quantization and encoding are often implemented simultaneously during the conversion process.
1. ADC: Analog/digital converter or analog/digital converter. It refers to a device that converts continuous variable analog signals into discrete digital signals.
A typical analog-to-digital converter converts an analog signal into a digital signal that represents a proportional voltage value.
2. When performing analog/digital conversion, the analog signal must be sampled at certain time intervals, and then the sampled value must be converted into a digital quantity. Therefore, the basic process of analog/digital conversion consists of ① sampling, ② holding, ③ quantization and ④ encoding.
Usually, the two processes of sampling and holding are completed by a sample-hold circuit, and quantization and encoding are often implemented simultaneously during the conversion process.
12.1.2 ADC principle
There are many types of ADCs which can be roughly divided into
Successive comparison approximation type, parallel comparison type, integration type, Σ-Δ modulation type, and voltage-to-frequency conversion type.
these types. Please search Baidu for the specific details.
Of course these types have their own advantages and disadvantages. Look at the picture below:
1- Sample and hold
1). The switch S is controlled by the sampling signal vS:
Let’s look at two pictures first:
Here are a few things you can know from the picture above:
(1) When vs is high level, S is closed, and in the sampling stage, vo=vI;
(2) When vs is low level, S is disconnected and is in the holding phase. At this time, since the capacitor has no discharge circuit, vO remains at the instantaneous value of the input voltage at the end of the last sampling.
The digital signal output by A/D conversion is then converted to D/A. The closeness of the obtained analog signal to the original input signal is closely related to the sampling frequency.
2) Sampling theorem
What's sampling?
Define something like this:
Sampling is to extract the measured analog signal amplitude at times T, 2T, 3T,... with an interval of T. The interval T between two adjacent sampling times is also called the sampling period.
Only when the sampling frequency fs is greater than or equal to 2 times the highest frequency component fmax of the analog signal v (fs≥2fmax), the collected signal samples can reflect the changing pattern of the original analog signal without distortion.
For example: If the frequency of the highest frequency component of the sampled signal is 100Hz, the sampling frequency should not be lower than 200Hz.
3), holding circuit
2-Quantization and encoding
1. What is quantification?
After we sample the analog signal, we will get a sequence of pulse signals that are discrete in time, but the amplitude of each pulse is still continuous. However, the digital signals that the CPU can process are not only discrete in time, but also the changes in value are discontinuous. Therefore, the amplitude of each pulse after sampling must be discretized to obtain the discrete value processed by the CPU. , this process is called quantification.
To put it bluntly, during the A/D conversion process, the output voltage of the sample-and-hold circuit must be planned to the corresponding discrete level in a certain approximate manner.
2. What is coding?
The binary representation of the quantization result is called encoding. Moreover, an n-bit quantized result value is exactly represented by an n-bit binary number. This n-bit binary number is the output result after the ADC conversion is completed.
To put it bluntly, it is a quantization process. It just rounds the analog signal according to the quantization unit. Only by using a code to represent the quantized value can the digital quantity be obtained. Of course, the commonly used encoding is binary encoding.
Of course, there are two ways to encode: look at the picture below:
1. Only rounding is not done when rounding, that is to say, when the voltage is 0-1v, the voltage is 0, when the voltage is 1-2v, the voltage is 1, and so on. Using this method, the input voltage is always higher than the output voltage, so the resulting quantization error cannot be negative.
2. There is rounding when rounding (that is, rounding): that is, 0-0.5V is taken as 0, 0.5-1.5V is taken as 1, and so on. From this we can see that the quantization error here is both positive and negative.
In fact, quantification is simply a process of rounding up analog signals in real time.
3-Conversion speed
It refers to the time required from receiving the conversion control signal to obtaining a stable digital output signal at the output end. The conversion speed is usually expressed by the time required to complete an A/D conversion operation.
For example, if the conversion time T of an ADC is 10ms, then the conversion speed of the A/D converter is 1/T=100 times/s.
4-Resolution
Resolution can also be called resolution. Used to describe scale divisions. The resolution is often expressed in terms of the number of bits in the output binary code. The more digits, the smaller the quantization error, and the higher the conversion accuracy. Camera digital processing is used in many places.
5-Quantization error
Quantization error refers to the error caused by quantization, which is the two situations mentioned above.
6-Accuracy
Accuracy refers to the total error between the ideal value and the actual value of the required analog voltage to produce a given digital output, including errors caused by quantization error, zero point error and nonlinearity. Used to describe the accuracy of physical quantities.
Pay special attention: precision and resolution are not the same.
7-Input analog voltage range
The input analog voltage range refers to the allowed input voltage range of the ADC. Beyond this range, the A/D converter will not work properly. For example: STM32F429 input voltage range is: unipolar 0~V_ref.
8-Conversion time
Conversion time is the time required for the ADC to complete an A/D conversion. It refers to the total time required from starting the ADC to obtaining the corresponding data.
12.2 Structure of STM32F429 ADC
After the above content, we already have a general understanding of the basics of ADC.
Let’s talk about the ADC in STM32.
12.2.1 Introduction to STM32
ADC main structural content:
12-bit resolution
Interrupts are generated on end of conversion, end of injected conversion, and analog watchdog events.
Single and continuous conversion modes
Auto scan mode from channel 0 to channel n
self-calibration
Data alignment with built-in data consistency
Sampling intervals can be individually programmed per channel
Both rule transformations and injection transformations have external triggering options
Intermittent mode
Dual mode (devices with 2 or more ADCs)
ADC conversion time: When the clock is 56MHz, the shortest ADC conversion time is 1μs
ADC power supply requirements: 2.4V to 3.6V
ADC input range: VREF- ≤ VIN ≤ VREF+
A DMA request is generated during regular channel conversion.
STM32F429IGT6 has 3 ADC controllers: its core is an analog-to-digital converter, which is triggered by software or hardware and driven by the ADC clock ADCLK to sample, quantize and encode analog signals in regular channels or injected channels.
1. The 12-bit ADC is a successive approximation analog-to-digital converter that can be configured with 10-bit, 8-bit or 6-bit resolution.
2. Up to 19 multiplexed channels, capable of measuring signals from 16 external sources, two internal sources and VBAT channels.
3. A/D conversion can be performed in single, continuous, scanning or discontinuous
Performed in sampling mode.
4、ADC 的结果存储在一个左对齐或右对齐的 16 位数据寄存器中。
5、ADC具有模拟看门狗特性,允许应用检测输入电压是否超过了用户自定义的阈值上限或下限。
6、多种ADC转换触发方式:软件方式、定时器、EXTI 中断线。
7、可触发DMA功能(可看DMA章节)。
ADC内部结构图:
ADC电路走向:
Previous article:Some professional terms in STM32F10x
Next article:Interpretation of STM32 minimum system things
Recommended ReadingLatest update time:2024-11-22 20:38
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- Cypress Embedded USB Host/Peripheral Controllers
- Microcontroller Study Notes
- Design of 1GHz bandwidth RF digitizer by using high speed ADC technology
- PPTC devices protect automotive electronics from reverse polarity damage
- KiCAD JLCPCB Tools
- Differences between NAND flash and NOR flash in software support
- 【1】First look at Silicon Labs development kit
- EEWORLD University - Keysight Two-Minute Mentor Season 1
- The Definitive Guide to Visual Studio Code
- Portable power supply circuit