Download as PPTX, PDF, TXT or read online from Scribd
Download as pptx, pdf, or txt
You are on page 1of 32
ADC INTERFACING
Digital computers use binary (discrete)
values, but in the physical world everything is analog (continuous). Temperature, pressure (wind or liquid), humidity, and velocity are a few examples of physical quantities that we deal with every day.
A physical quantity is converted to electrical
(voltage, current) signals using a device called a transducer or sensor. • ADC is inside ATMega32. • Total 8 ADC pins(PA0-PA&) inside ATMega32. • Sensor is connected to any one of these pins. • Analog data enter in ATMega32 . • ADC inside ATMega32 convert it into 8bit or 10 bit equivalent output and the digital data given to CPU. • Depends on program in memory ,CPU process the data and finally the o/p data is given to O/P display device like LCD. • When Microcontroller will give a 0 to 1 pulse to start conversion pin,the conversion process will be started. • Vref is the reference voltage given to ADC. • It is the maximum i/P voltage that can be accepted by the ADC. • If a 5V line is connected to Vref ,then the maximum i/p that can be accepted by the ADC i/p line is 5V. • If 5V signal comes on Vin(i/p pin) from sensor,then the maximum output will be 1111 1111. Some of major characteristics of the ADC Step size and conversion time of ADC
• Step size(Resolution) is the smallect change at the input
that can be detected by the ADC. • Even if the i/p is so small ,ADC is capable of detecting the small signal.(Advantage) • Formula of resolution=Vref/2n • High resolution (smaller value)ADC has more precise output. • Resolution can be improved by increasing the number of bits or reducing the reference voltage. • Conversion time is the time taken by the ADC to convert input analog signal to equivalent digital signal. In an 8 bit ADC we have an 8 bit digital data output of D0-D7.
Where Dout = digital data output (in
decimal) Vin = analog input data and step size is the resolution. ADC Programming in the AVR AVR microcontrollers have on-chip ADC peripheral like timers. a) It is a 10-bit ADC
b) It has 8 analog input channels, 7
differential input channels, and 2 differential input channels with optional gain of 10X and 200x.
c) The converted output data is held by
two special function registers called ADCL(A/D Conversion Low) and ADCH. d) ADCL:ADCH is 16 bits
e) We have three option for Vref. Vref can
be connected to Avcc, internal 2.56V, or external AREF pin.
f) The conversion time is dictated by the
crystal frequency connected by the XTAL pins and ADPS0:2.(ADC prescalar) ADC Control and Status Register
The ADCSRA Register is the status
and control register of ADC. 1. Make the pin for the selected ADC channel an input pin. 2. Turn on the ADC module of the AVR because it is disabled upon power-on reset to save power. 3. Select the conversion speed. We use register ADPS2:0 to select the conversion speed. 4. Select voltage reference and ADC input channels. We use REFS0 and REFS1 bits in the ADMUX register to select voltage reference and the MUX4:0 bits in ADMUX to select the ADC input channel. 5. Activate the start conversion bit by writing a one to the ADSC bit of ADCSRA. 6. Wait for the conversion to be completed by polling the ADIF bit in the ADCSRA register 7. After the ADIF bit has gone HIGH, read the ADCL and ADCH registers to get the digital data output. 8. If you want to read the selected channel again, go back to step 5. 9. If you want to select another vref source or input channel, go back to step 4. Thank You