mucahitdemir / STM32F4xx-Timers-PWM-PLL-CANbus-Low-Power-Modes

This repository covers a famous online course on Udemy mentioned above. I learned different peripherals with code exercices related with PWM, CAN, and Low-power Mode MCUs.
8 stars 1 forks source link

Analog-to-Digital Conversion (ADC) Fundamentals #6

Open mucahitdemir opened 2 years ago

mucahitdemir commented 2 years ago

Microcontrollers are capable of detecting binary signals: is the button pressed or not? These are digital signals. When a microcontroller is powered from five volts, it understands zero volts (0V) as a binary 0 and a five volts (5V) as a binary 1.

The world however is not so simple and likes to use shades of gray. What if the signal is 2.72V? Is that a zero or a one?

What is the ADC?

An Analog-Digital Converter (ADC) is a very useful feature that converts an analog voltage on a pin to a digital number. By converting from the analog world to the digital world, we can begin to use electronics to interface with the analog world around us.

ADCs can vary greatly between microcontrollers. The ADC on the Arduino is a 10-bit ADC meaning it has the ability to detect 1,024 (2^10) discrete analog levels. Some microcontrollers (ST, TI, NXP, etc.) have 8-bit ADCs (2^8 = 256 discrete levels) and some have 16-bit ADCs (2^16 = 65,536 discrete levels).

image

Source: Sparkfun ADC fundamentals

mucahitdemir commented 2 years ago

Quantizing and Encoding On the output of (S/H), a certain voltage level is present. We assign a numerical value to it. The nearest value, in correspondence with the amplitude of sampling and holding signal, is searched. And this value cannot be just any value, it should be from a limited set of possible values

image

mucahitdemir commented 2 years ago

The following table shows the performance of different ‘n’ bit ADCs. If the number of bits is greater, then the frequency is lesser and time consumed is also greater. On the other hand, the error minimizes as the number of bits is increased. The maximum sampling rates have also been indicated in the table. (Source: https://microcontrollerslab.com/analog-to-digital-adc-converter-working/) image