STM32 ADC voltage value calculation

Publisher:幸福时光Latest update time:2016-08-23 Source: eefocusKeywords:STM32  ADC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
When using the STM32 ADC to detect voltage, the calculation of the voltage value must be involved. In order to obtain the voltage more efficiently, there are now three methods:

The result you get is the voltage value on your current AD pin relative to 3.3V and 4096 converted into a digital number.
If the AD result you get is the variable ADC_DR, they have the following relationship:


ADC_DR/current voltage value = 4096/3300 mV If you want to get the current voltage value in reverse, you can calculate it as follows:
unsigned long Voltage;
Voltage = ADC_DR; 

//---Assume that the AD result you get is stored in the variable ADC_DR;
Voltage = (Voltage * 3300)/4096; //----you get the correct voltage result, the unit is mV

Generally for efficiency, we will reduce it ourselves:
Voltage = (Voltage * 825)/1024; //----you get the correct voltage result, the unit is mV

And further, the efficiency will be higher:
Voltage = (Voltage * 825)>>10; //----you get the correct voltage result, the unit is mV

Keywords:STM32  ADC Reference address:STM32 ADC voltage value calculation

Previous article:LPC11XX.h header file analysis
Next article:LPC2368 can baud rate learning

Recommended ReadingLatest update time:2024-11-17 00:20

STM32-IIC analog slave mode
Here we are talking about simulated IIC, not hardware IIC. Why use software simulated IIC instead of hardware IIC? In addition to the problems of ST's IIC module itself, it is also because hardware IIC is not convenient to transplant and cannot be used universally in different MCUs; and some projects require switching
[Microcontroller]
STM32 ST-LINK Utility introduction, download, installation and usage
Ⅰ. Write in front This article describes the introduction, download, installation, and usage of the STM32 ST-LINK Utility. If you need to know more about STM32-related articles, you can visit my blog or WeChat public account to view and download them. The STM32 ST-LINK Utility software tool is actually a host comp
[Microcontroller]
STM32 ST-LINK Utility introduction, download, installation and usage
STM32 one timer outputs 4 PWMs with different frequencies and adjustable duty cycles
main.c /*********************************************      Title: Exercise on operating USART      Software platform: MDK-ARM Standard Version4.70      Hardware platform: stm32f4-discovery        Main frequency: 168M      Periph_Driver_version: V1.0.0            Description: Use one timer (TIM3) to implement four PW
[Microcontroller]
STM32 general timer
There are many types of timers in STM32, which are divided into 2 advanced controller timers, 4 ordinary timers, 2 basic timers, 2 watchdog timers, and 1 system tick timer SysTick according to their functions. The key to the timer is the calculation of the timing time. For example, when using a timer to control the
[Microcontroller]
STM32 general timer
51 microcontroller learning: ADC analog-to-digital conversion experiment-external channel voltage collection
Experiment name: ADC analog-to-digital conversion experiment--external channel voltage collection wiring description: Experiment phenomenon: After downloading the program, the digital tube displays the voltage value of the AD module collecting the external channel AIN3. Notes: ********** ******************************
[Microcontroller]
STM32 clock introduction and configuration method
When using any peripheral in STM32, the corresponding clock must be turned on. There are 5 clock sources for users to choose from in STM32: 1.HSI high-speed internal clock, RC oscillator, frequency is 8MHz. 2.HSE high speed external clock, right-hand/ceramic resonator, or external clock source, 4MHz-16MHz. 3.LSI inter
[Microcontroller]
NS software radio application based on analog-to-digital converter series
Abstract: In view of the characteristics and limitations of traditional hardware radio architecture, the application requirements of analog-to-digital converters in software radio design are analyzed, and a new product series of 12-bit giga-sampling converters and the matching differential amplifiers and clock
[Analog Electronics]
NS software radio application based on analog-to-digital converter series
Analyzing the Challenges of Smart Meter Design
The adoption of smart meters has given companies and engineers more opportunities to design metering solutions that comply with evolving global standards, are future-proof, and will be part of mass-market solutions, i.e., low-cost solutions. However, there are many challenges to overcome in designing successful me
[Embedded]
Analyzing the Challenges of Smart Meter Design
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号