Presentation is loading. Please wait.

Presentation is loading. Please wait.

Analog to Digital Converter (ADC). Analog to Digital Converters  Microcontroller understands only digital language.  To convert the analog output from.

Similar presentations


Presentation on theme: "Analog to Digital Converter (ADC). Analog to Digital Converters  Microcontroller understands only digital language.  To convert the analog output from."— Presentation transcript:

1 Analog to Digital Converter (ADC)

2 Analog to Digital Converters  Microcontroller understands only digital language.  To convert the analog output from the sensors to digital we need ADC.  In AVR family of microcontroller we have inbuilt ADC on PORTA. Each pin in PORTA has a ADC circuit connected behind it. Thus we have 8 channels of ADC.  The resolution of ADC output is 10 bit i.e. the output from the ADC is any number between 0 to 1023, where 0 corresponds to 0V and 1023 corresponds to 5 V.  The reference voltage of the ADC is fixed with the help of REFS bits in ADMUX register.

3 ADC It is a device that converts an analog input into a digital value ( a number). A ‘n’ bit ADC can covert the i/p to a value between 0 to 2 n -1 For ex. For a 8 bit ADC, with the dynamic range of 5 V gives the following O/p.

4 Process of A-D Conversion The conversion is 3 step process SamplingQuantizationCoding

5 ADC Vout is ANALOG But uC being digital can only read it as 0 or 1. 0 if Vout < 2.5 V 1 if Vout > 2.5 V However most applications require much higher resolution & multiple levels.

6 ADC In general O/p = ( V in / V ref ) * 2 n V ref is the max value of i/p that is expected

7

8 Analog to Digital Convertor (ADC) ATmega16 has an inbuilt 10 bit ADC (1024 Levels) 8 Multiplexed Single Ended Input Channels 7 Differential Input Channels

9 Registers of ADC Registers used in the ADC  ADMUX – ADC Multiplexer Selection Register  ADCW – ADC Word  ADCSRA – ADC Control and Status Register A

10 Using ADC (WinAVR) #include #include “adc.h” #include “lcd.h” void main( ) { int x; DDRA=0b00000000; ADCinit();// initializes ADC LCDinit( ); LCDclr( ); while(1) { x= ADCread(7);// converts analog i/p at pin 7 to digital LCDgotoXY(0,5); LCDWriteInt(x,5); _delay_ms(300); }

11 Check point !!!!! Make sure you include adc.h and adc.c in ur folder In make-file, add the.c file to the src list SRC= $(TARGET).c lcd.c adc.c


Download ppt "Analog to Digital Converter (ADC). Analog to Digital Converters  Microcontroller understands only digital language.  To convert the analog output from."

Similar presentations


Ads by Google