07 Analogue to Digital Converter(ADC).2016

17
1 07-ADC (Analog to Digital Converter). By : Mohamed Fawzy Programming AVR Microcontrollers © Mohamed F.A.B 2015

Transcript of 07 Analogue to Digital Converter(ADC).2016

Page 1: 07 Analogue to Digital Converter(ADC).2016

1

07-ADC (Analog to Digital Converter).

By : Mohamed Fawzy

Programming AVR Microcontrollers

© Mohamed F.A.B 2015

Page 2: 07 Analogue to Digital Converter(ADC).2016

Lecture Notes:

2

o Set Your Phone To Vibration Mode.

o Ask any time.

o During labs, Feel Free To Check Any Materials or

Internet.

o Slides are self content.

o Feel Free To Share This Materials With Your Friends.

o Work Hard For Achieving Most Of This Course.

© Mohamed F.A.B 2015

Page 3: 07 Analogue to Digital Converter(ADC).2016

3

Don't Forget !!!!

© Mohamed F.A.B 2015

Any Expert Was Once A Beginner

Page 4: 07 Analogue to Digital Converter(ADC).2016

4

Lesson(12).

© Mohamed F.A.B 2015

Lesson (12):

Analogue to Digital Conversion.

Page 5: 07 Analogue to Digital Converter(ADC).2016

5

Lesson (12) Topics.

© Mohamed F.A.B 2015

► What and Why ADC.

► Characteristics of ADC.

► Interfacing LM35 temperature sensor.

Page 6: 07 Analogue to Digital Converter(ADC).2016

6

What & Why ADC?

© Mohamed F.A.B 2015

Digital Computers uses binary values, but in physical

world everything is analog.

Temperature, Pressure, humidity, and velocity are

examples of physical quantities.

A physical quantity is converted to electrical signals

(voltage or current) using device called sensor.

So, we need Analog-to-Digital Converter to translate

the analog signal to digital numbers so that micro-

controller can read and process them.

Page 7: 07 Analogue to Digital Converter(ADC).2016

7

Example.

© Mohamed F.A.B 2015

AnalogD

igita

l

0

1

1

0

0

0

0

1

Page 8: 07 Analogue to Digital Converter(ADC).2016

8

Characteristics of ADC.

© Mohamed F.A.B 2015

The resolution of ADC is the number of bits at which

converted data stored in such as 8, 10, 16 or even 24-bit.

Resolution

Vref

It is an input voltage used for voltage reference.

𝑠𝑡𝑒𝑝 𝑠𝑖𝑧𝑒 =[(𝑉𝑟𝑒𝑓+) − (𝑉𝑟𝑒𝑓−)]

2𝐵𝑖𝑡 𝑛𝑜

𝑠𝑡𝑒𝑝 𝑠𝑖𝑧𝑒 =[5 −0 ]

210=

5

1024=0.00488 V*1000=4.88 mv

Higher resolution ADCs means smaller step size and high accuracy.

Smaller Vref ADCs means smaller step size and high accuracy.

NOTES:

Page 9: 07 Analogue to Digital Converter(ADC).2016

9

Characteristics of ADC. Cont’

© Mohamed F.A.B 2015

Conversion Time:

Conversion time is the time it takes to convert the

single analogue sample to digital.

o Example.

Digital Output=𝑉_𝐼𝑛𝑝𝑢𝑡

𝑆𝑡𝑒𝑝_𝑆𝑖𝑧𝑒

Page 10: 07 Analogue to Digital Converter(ADC).2016

10

ADC Features of ATMEGA32.

© Mohamed F.A.B 2015

10 bit ADC.

It has 8 analog input channels.

Converted output binary data is held by two

registers ADCL and ADCH.

Three options for Vref (VCC or 2.56V or External

AREF pin).

Conversion time is defined by crystal frequency

connected to XTAL pins and ADPS0:2.

Page 11: 07 Analogue to Digital Converter(ADC).2016

11

ADC registers in ATMEGA32.

© Mohamed F.A.B 2015

Page 12: 07 Analogue to Digital Converter(ADC).2016

12

ADC registers in ATMEGA32. cont’

© Mohamed F.A.B 2015

Page 13: 07 Analogue to Digital Converter(ADC).2016

13

ADC registers in ATMEGA32. cont’

© Mohamed F.A.B 2015

• Bit 7 – ADEN : ADC Enable.

• Bit 6 – ADSC :ADC Start Conversion.

• Bit 5 – ADATE :ADC Auto Trigger Enable.

• Bit 4 – ADIF:ADC Interrupt Flag.

• Bit 3 – ADIE:ADC Interrupt Enable.

• Bit 2:0 – ADPS2:0: ADC Prescaler Select Bits.

Page 14: 07 Analogue to Digital Converter(ADC).2016

14

ADC conversion time.

© Mohamed F.A.B 2015

Page 15: 07 Analogue to Digital Converter(ADC).2016

15

ADC in ATMEGA32.

© Mohamed F.A.B 2015

We need to make digital voltmeter to measure 5 volt power supply.What about 12V or 24V

Exercise (1).

We need to make temperature controller using LM35

Temperature sensor.

Exercise (2).

Page 16: 07 Analogue to Digital Converter(ADC).2016

16

Questions:

© Mohamed F.A.B 2015

Page 17: 07 Analogue to Digital Converter(ADC).2016

Thank You All

17

[email protected]

01006032792

[email protected]

© Mohamed F.A.B 2015