CN111240251A - High-precision AD sampling correction method based on MCU - Google Patents
High-precision AD sampling correction method based on MCU Download PDFInfo
- Publication number
- CN111240251A CN111240251A CN202010210711.7A CN202010210711A CN111240251A CN 111240251 A CN111240251 A CN 111240251A CN 202010210711 A CN202010210711 A CN 202010210711A CN 111240251 A CN111240251 A CN 111240251A
- Authority
- CN
- China
- Prior art keywords
- mcu
- precision
- power supply
- reference voltage
- error
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05B—CONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
- G05B19/00—Programme-control systems
- G05B19/02—Programme-control systems electric
- G05B19/04—Programme control other than numerical control, i.e. in sequence controllers or logic controllers
- G05B19/042—Programme control other than numerical control, i.e. in sequence controllers or logic controllers using digital processors
- G05B19/0423—Input/output
-
- H—ELECTRICITY
- H03—ELECTRONIC CIRCUITRY
- H03M—CODING; DECODING; CODE CONVERSION IN GENERAL
- H03M1/00—Analogue/digital conversion; Digital/analogue conversion
- H03M1/10—Calibration or testing
- H03M1/1009—Calibration
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05B—CONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
- G05B2219/00—Program-control systems
- G05B2219/20—Pc systems
- G05B2219/21—Pc I-O input output
- G05B2219/21064—Calibration: automatic of a-d convertor, store null and maximum in eeprom
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Automation & Control Theory (AREA)
- Theoretical Computer Science (AREA)
- Analogue/Digital Conversion (AREA)
Abstract
The invention discloses a high-precision AD sampling correction method based on an MCU (microprogrammed control Unit). the MCU samples a high-precision reference voltage with any value and compares an AD conversion result with a theoretical value; if the error exceeds the error range of the reference voltage, the AD conversion result of the MCU is considered to be the deviation caused by the power supply error of the MCU ADC module, and the deviation needs to be corrected. The invention has the advantages of low cost and high precision for all sensor signals sampled by the MCU. By sampling the high-precision reference voltage, the power supply of the MCU ADC module can be corrected, so that the precision of the MCU ADC module power supply is improved; the limitation that the VREF voltage of the MCU reference power supply needs to be matched with the maximum amplitude of a signal to be converted is solved, an MCU chip with a VREF independent pin is not needed, a circuit is not needed to be added to the MCU high-precision power supply independently, only a constant reference voltage with higher precision needs to be selected from an original power supply system, and the circuit cost is greatly reduced.
Description
Technical Field
The invention relates to the technical field of motor control, in particular to a high-precision AD sampling correction method based on an MCU.
Background
In a data acquisition system, an analog-to-digital converter is a crucial link, and the accuracy of the analog-to-digital converter and the cost of the system directly influence the practicability of the system, so how to improve the accuracy of the analog-to-digital converter and reduce the cost of the system is a standard for judging whether the system has practical application value. In practical applications, errors may be introduced due to changes of parameters such as ambient temperature and humidity, and certain errors may be caused by instability of the power supply voltage. Of course, a power module with a good temperature coefficient and high precision can be selected to provide stable voltage. However, the high-precision voltage management module is often expensive, which greatly increases the cost of the system.
The closest technology to the technology is mainly as follows:
1. the analog power supply and the digital power supply of the MCU are separately powered, so that the crosstalk generated between the AD port and the I/O port is reduced;
2. the analog power supply of the MCU is supplied with power by a high-precision power supply;
3. as shown in fig. 1, the ADC sampling accuracy is improved by improving the accuracy of the reference power supply (VREF) of the ADC module of the MCU.
In the general method in the prior art 1, an analog power supply and a digital power supply of the MCU are separately powered, so that although interference is avoided, too low accuracy of the analog power supply may result in a large error in the obtained sampling result.
In the general method of the prior art 2, a high-precision power supply is adopted for supplying power to an analog power supply of the MCU, so that the circuit cost is greatly increased, but the high-precision reference power supply output by the LDO is adopted for supplying power, and the output current is too small to meet the normal work of the circuit.
In the general method of prior art 3, the high-precision power supply output through the LDO supplies power to the VREF pin of the MCU, and the voltage of VREF needs to be matched with the maximum amplitude of the signal to be converted, and if it cannot be matched, the precision of the converted signal will also decrease, as shown in fig. 2, if there is no required VREF in the original power supply system, a circuit needs to be added additionally to increase the cost, and meanwhile, the chip with the VREF independent pin is selected to be limited, thereby increasing the cost.
Disclosure of Invention
The invention aims to: a high-precision AD sampling correction method based on the MCU is designed by combining the digital-to-analog conversion precision requirement and the system cost requirement.
The technical scheme of the invention is as follows:
a high-precision AD sampling correction method based on an MCU comprises the following steps:
s1, the MCU samples the high-precision reference voltage of any value, compares the AD conversion result with a theoretical value and calculates an error;
s2, if the error is in the error range of the reference voltage, the AD conversion result of the MCU is considered to be accurate, the error is caused by the reference voltage, and the result does not need to be corrected;
and S3, if the error exceeds the error range of the reference voltage, the AD conversion result of the MCU is considered to be the deviation caused by the power supply error of the MCU ADC module, and the deviation needs to be corrected.
Preferably, in step S3, when the AD conversion error of the reference voltage exceeds the error range of the reference voltage, the method for correcting the result includes:
multiplying ADC power supply voltage VDDA of MCU by actual AD conversion result AD of reference voltageActual referenceThen divided by the theoretical AD conversion result AD of the reference voltageTheoretical referenceTo obtain the corrected MCU ADC power supply voltage, i.e.
Finally, other AD sampling results are ADPractice ofIs divided by (2)n-1) multiplying the corrected MCU ADC supply voltage VDDACorrection ofObtaining the corrected sampling voltage VCorrection ofI.e. by Wherein n is the sampling precision of the MCU. The invention has the advantages that:
the invention has the advantages of low cost and high precision for all sensor signals sampled by the MCU. By sampling the high-precision reference voltage, the power supply of the MCU ADC module can be corrected, so that the precision of the MCU ADC module power supply is improved; the method has the advantages that the limitation that the reference power VREF voltage of the MCU needs to be matched with the maximum amplitude of a signal to be converted is solved, an MCU chip with a VREF independent pin is not needed, a circuit is not needed to be added to the high-precision power supply of the MCU independently, only a constant voltage with higher precision needs to be selected from the original power supply system, and the circuit cost is greatly reduced.
Drawings
The invention is further described with reference to the following figures and examples:
FIG. 1 is a schematic diagram of MCU ADC sampling with VREF independent pin;
FIG. 2 is a diagram illustrating the inability of the voltage of VREF to match the maximum amplitude of the signal to be converted;
FIG. 3 is a schematic diagram of the MCU-based high-precision AD sampling correction method of the present invention.
Detailed Description
As shown in fig. 3, the MCU-based high-precision AD sampling correction method of the present invention includes:
s1, the MCU samples the high-precision reference voltage of any value, compares the AD conversion result with a theoretical value and calculates an error;
s2, if the error is in the error range of the reference voltage, the AD conversion result of the MCU is considered to be accurate, the error is caused by the reference voltage, and the result does not need to be corrected;
and S3, if the error exceeds the error range of the reference voltage, the AD conversion result of the MCU is considered to be the deviation caused by the power supply error of the MCU ADC module, and the deviation needs to be corrected.
When the AD conversion error of the reference voltage exceeds the error range of the reference voltage, the method for correcting the result comprises the following steps: multiplying ADC power supply voltage VDDA of MCU by actual AD conversion result AD of reference voltageActual referenceThen divided by the theoretical AD conversion result AD of the reference voltageTheoretical referenceTo obtain the corrected MCU ADC power supply voltage, i.e.Finally, other AD sampling results are ADPractice ofIs divided by (2)n-1) multiplying the corrected MCU ADC supply voltage VDDACorrection ofObtaining the corrected sampling voltage VCorrection ofI.e. byWherein n is the sampling precision of the MCU.
For example: when the MCU samples the 2.5V reference voltage with the precision of 0.5 percent, the ADC power supply of the MCU is 5V, the sampling precision of the MCU is 12 bits, and the theoretical AD conversion value of the reference voltage is known to beAcceptable error range for AD isIf the actual AD conversion value of the reference voltage is 2050, no correction is required for other AD sampling results. If the actual AD conversion value of the reference voltage is 2030, the corrected power supply voltage of the MCU ADC isAnd other AD sampling results can convert the actual AD value into analog quantity according to a 4.96V power supply.
The above embodiments are merely illustrative of the technical ideas and features of the present invention, and the purpose of the embodiments is to enable those skilled in the art to understand the contents of the present invention and implement the present invention, and not to limit the protection scope of the present invention. All modifications made according to the spirit of the main technical scheme of the invention are covered in the protection scope of the invention.
Claims (2)
1. A high-precision AD sampling correction method based on an MCU is characterized by comprising the following steps:
s1, the MCU samples the high-precision reference voltage of any value, compares the AD conversion result with a theoretical value and calculates an error;
s2, if the error is in the error range of the reference voltage, the AD conversion result of the MCU is considered to be accurate, the error is caused by the reference voltage, and the result does not need to be corrected;
and S3, if the error exceeds the error range of the reference voltage, the AD conversion result of the MCU is considered to be the deviation caused by the power supply error of the MCU ADC module, and the deviation needs to be corrected.
2. The MCU-based high-precision AD sampling calibration method of claim 1, wherein in step S3, when the AD conversion error of the reference voltage exceeds the error range of the reference voltage, the method for correcting the result comprises:
multiplying ADC power supply voltage VDDA of MCU by actual AD conversion result AD of reference voltageActual referenceThen divided by the theoretical AD conversion result AD of the reference voltageTheoretical referenceTo obtain the corrected MCU ADC power supply voltage, i.e.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010210711.7A CN111240251A (en) | 2020-03-24 | 2020-03-24 | High-precision AD sampling correction method based on MCU |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010210711.7A CN111240251A (en) | 2020-03-24 | 2020-03-24 | High-precision AD sampling correction method based on MCU |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111240251A true CN111240251A (en) | 2020-06-05 |
Family
ID=70869124
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010210711.7A Pending CN111240251A (en) | 2020-03-24 | 2020-03-24 | High-precision AD sampling correction method based on MCU |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111240251A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113759160A (en) * | 2020-06-11 | 2021-12-07 | 卓品智能科技无锡有限公司 | Method for improving analog acquisition precision |
CN115224912A (en) * | 2022-09-19 | 2022-10-21 | 长城电源技术有限公司 | Current sampling correction value obtaining method and device working method obtained by current sampling correction value obtaining method and device |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS63128817A (en) * | 1986-11-19 | 1988-06-01 | Yamatake Honeywell Co Ltd | Converting value correcting method in a/d conversion circuit |
CN102096383A (en) * | 2010-12-28 | 2011-06-15 | 重庆长安汽车股份有限公司 | High-precision signal sampling circuit |
CN104639053A (en) * | 2015-01-27 | 2015-05-20 | 浙江大学 | High-precision weak signal amplification and measurement method |
US9559716B1 (en) * | 2015-08-28 | 2017-01-31 | Renesas Electronics Corporation | AD converter, AD convert apparatus, and AD convert method |
-
2020
- 2020-03-24 CN CN202010210711.7A patent/CN111240251A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS63128817A (en) * | 1986-11-19 | 1988-06-01 | Yamatake Honeywell Co Ltd | Converting value correcting method in a/d conversion circuit |
CN102096383A (en) * | 2010-12-28 | 2011-06-15 | 重庆长安汽车股份有限公司 | High-precision signal sampling circuit |
CN104639053A (en) * | 2015-01-27 | 2015-05-20 | 浙江大学 | High-precision weak signal amplification and measurement method |
US9559716B1 (en) * | 2015-08-28 | 2017-01-31 | Renesas Electronics Corporation | AD converter, AD convert apparatus, and AD convert method |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113759160A (en) * | 2020-06-11 | 2021-12-07 | 卓品智能科技无锡有限公司 | Method for improving analog acquisition precision |
CN115224912A (en) * | 2022-09-19 | 2022-10-21 | 长城电源技术有限公司 | Current sampling correction value obtaining method and device working method obtained by current sampling correction value obtaining method and device |
CN115224912B (en) * | 2022-09-19 | 2022-12-06 | 长城电源技术有限公司 | Current sampling correction value obtaining method and device working method obtained by current sampling correction value obtaining method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111240251A (en) | High-precision AD sampling correction method based on MCU | |
US5121119A (en) | Analog-to-digital conversion method and system with correction of analog gain and offset | |
KR20230118863A (en) | On-chip RC oscillators, chips and communication terminals | |
US20200127675A1 (en) | Soc baseband chip and mismatch calibration circuit for a current steering digital-to-analog converter thereof | |
US8648586B2 (en) | Circuit for sensing load current of a voltage regulator | |
WO2022016813A1 (en) | Current calibration method and system based on voltage compensation of current sensor | |
CN202231703U (en) | Self-calibration circuit of digital to analog conversion output voltage | |
CN101923366A (en) | CMOS (Complementary Metal-Oxide-Semiconductor) band-gap reference voltage source with fuse correction | |
CN100533954C (en) | Float restraint amplification circuit in sensor network | |
CN115167596B (en) | Novel subsection compensation band gap reference circuit | |
CN116069111A (en) | High-low Wen Qulv compensation zener reference voltage source circuit | |
CN216486172U (en) | Reference source circuit with stable band gap reference voltage | |
WO2022165921A1 (en) | Digital-to-analog conversion apparatus and method | |
CN101655687B (en) | Calibration system of voltage error | |
CN110927594B (en) | Battery detection calibration method | |
CN210183317U (en) | Specific-range high-precision successive approximation type 8-bit analog-to-digital conversion circuit | |
CN218411218U (en) | Temperature drift compensation and decoding circuit of circular induction synchronizer | |
CN1077683C (en) | Temp. measuring circuit | |
CN217640048U (en) | Voltage and current regulating circuit for switching power supply | |
CN218122504U (en) | Humidity channel of high-precision automatic meteorological station signal simulator | |
CN221175305U (en) | Constant current power supply circuit and load device | |
CN214748524U (en) | High-precision and adjustable temperature measurement system | |
CN219798589U (en) | Locomotive brake cylinder air pressure monitoring sensor | |
CN220305452U (en) | Chip input voltage detection device | |
CN112350672B (en) | IF chip with digital compensation function and digital compensation method thereof |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |