ADC Introduction
In industrial control and intelligent instrument, MCU is commonly used for real-time control and real-time data processing. Due to the microcomputer, CPU can merely handle the digital information, and the control or measuring related parameter is often continuously changeable analog, such as temperature, pressure, speed, and voltage, etc. Only convert the continuous variational analog to digital quantity, single-chip microcomputer CPU can process. This process is called A/D conversion, and the equipment which is able to complete A/D conversion is called the A/D converter or ADC. At present, most microcontrollers in the market have their own ADC conversion interface. If there is no ADC conversion interface, the ADC digital-analog conversion chip can be used for external expansion.
How to Achieve That
ADC module is analog signals into digital signals, digital signals shown with 0 and 1. There is a reference voltage in an ADC module, and if the given reference voltage is 5 V, ADC is 12 bits. In other words, the reference voltage is divided into 2^12 parts, or 4096 parts, with a minimum resolution of VREF/4096.
That is to say, the binary value 000000000000 represents the input analog 0V, while 111111111111 represents the maximum VREF.
Then take the above figure C8051 microcomputer as an example, as shown in the schematic diagram, the microcomputer working power supply is 3.3v, the reference voltage is 2.048v, so the input range of the analog is 0~ 2.048 V. If the voltage range is larger than the reference voltage, the resistance divider can be used for voltage step-down or the operational amplifier can be used for reduction.
The MCU ADC is 12 bit. That is to say, when the input voltage is 0, the single-chip converted digital quantity result is 000000000000 (binary) when the input voltage is 2.048v, single-chip converted digital quantity result is 1111111111 (binary), the decimal system is 4095.
In other words, the value of the input voltage V=2.048* the digital amount collected by ADC/4095.
For example, we need to collect an analog voltage of 0~10V for display. Then, we can first reduce the voltage of 0~10V by five times, either by means of a resistance voltage divider or by means of operational amplifier reduction, and then connect it to the ADC sampling port of the single-chip microcomputer, the P2.2 port of the figure above.
The final conversion formula is V = result * 2.048/4095 * 5; Where the result is the digital quantity collected by microcomputer.
History
This is the initial published content. I will keep the list of revisions here.