Professional Documents
Culture Documents
Refrereces:
James Cockrell and Justin Loveless
Hossam Elkady Youtube Arabic Course
Practical Microcontroller Engineering with ARM Tech by Ying Bai
Analog-Digital Converter (ADC): Agenda
• How it works?
• Successive Approximation
• Register level TIVA ADC
• TIVAWare ADC driver library
• Examples
• Assignment
• ADC:
• Analog Signal:
Temperature Humidity
Pressure
Light Intensity
Level Sound
• ADC:
• Analog Signal:
01110111
ADC CPU
• ADC:
• Analog Signal:
Digital
Output
Time Time Time
10011100
• ADC: Step Size =
𝑽𝒓𝒆𝒇
𝟐
=
𝟓𝒗
𝟐
= 𝟐. 𝟓 𝟐𝟏 = 2 ADC
• Resolution:
1 Bit
Voltage (V)
5
4.5
4
3.5 High – Logic 1
3
2.5
2
1.5 LOW – Logic 0
1
0.5
0 Time (ms)
0 1 2 3 4 5 6 7 8
𝟓𝒗
• ADC: 𝟒
= 𝟏. 𝟐𝟓𝒗
𝟐𝟐 = 4 ADC
• Resolution:
2 Bit
Voltage (V)
5
4.5 11
4
3.5
3 10
2.5
2
01
1.5
1
0.5 00
0 Time (ms)
0 1 2 3 4 5 6 7 8
𝟓𝒗
• ADC: 𝟖
= 𝟎. 𝟔𝟐𝟓
𝟐𝟑 = 8 ADC
• Resolution:
3 Bit
Voltage (V)
5
4.5
111
4
110
3.5
101
3
100
2.5
011
2
010
1.5
001
1
000
0.5
0 Time (ms)
0 1 2 3 4 5 6 7 8
• ADC: Step Size =
𝟓𝒗
4096
= 𝟏. 𝟐 𝒎𝒗
𝟐𝟏𝟐 = 4096 ADC
• Resolution:
12 Bit
Voltage (mV)
12
10.8
9.6
8.4
7.2
6
4.8
3.6
2.4
1.2
0 Time (ms)
0 1 2 3 4 5 6 7 8
• ADC: Assume
• Successive Approximation ADC: Step Size
10 mV
0
0000 0000
• ADC: Assume
• Successive Approximation ADC: Step Size
10 mV
128 * 10 mv = 1.28 V
> 128
1V 1000 0000
• ADC: Assume
• Successive Approximation ADC: Step Size
10 mV
64 * 10 mv = 640 mV
< 64
1V 0100 0000
• ADC: Assume
• Successive Approximation ADC: Step Size
10 mV
96 * 10 mv = 960 mV
< 96
1V 0110 0000
• ADC: Assume
• Successive Approximation ADC: Step Size
10 mV
112 * 10 mv = 1120 mV
> 112
1V 0111 0000
• ADC: Assume
• Successive Approximation ADC: Step Size
10 mV
108 * 10 mv = 1080 mV
> 108
1V 0110 1000
• ADC: Assume
• Successive Approximation ADC: Step Size
10 mV
100 * 10 mv = 1000 mV
= 100
1V 0110 0100
• ADC: Assume
• Successive Approximation ADC: Step Size
10 mV
102 * 10 mv = 1020 mV
> 102
1V 0110 0110
• ADC: Assume
• Successive Approximation ADC: Step Size
10 mV
101 * 10 mv = 1010 mV
> 101
1V 0110 0101
• ADC: Assume
• Successive Approximation ADC: Step Size
10 mV
100 * 10 mv = 1000 mV
>
1V
0110 0100
• ADC:
Channels
Enable Clock
• ADC:
• ADC:
Software
Timer
GPIO
Trigger Etc.
• ADC:
Software
Timer
GPIO
Etc.
• ADC:
Vref
Software
Timer
GPIO
Etc.
TM4C ADC Specs
• Reference voltages:
• VREFP – tied to 3.3V on the Launchpad.
• VREFN – tied to ground on the Launchpad.
• Range & Resolution
• Range = 0 4095
• Resolution = 3.3V / 4096 = 8.05 mV (p. 803)
• Max Sampling Speed = 1 million samples/second
• Hardware Averaging
• Averages 4 samples in hardware during conversion
• Differential Sampling
• Sample the difference between two inputs
• Internal Temp Sensor
• Can be sampled for chip temp
• ADC:
• ADC:
• ADC:
• Sample Sequencer:
• ADC:
• Sample Sequencer:
• ADC:
• Differential versus Single-Ended:
A0 Digital A0
ADC Single-Ended
A1 Digital A1
A0
A1
• ADC:
• Internal Temperature Sensor:
• ADC:
• ADC Input:
12
Input Channels (A0 to A11)
ADC
Internal Temperature Sensor
Example 3: TIVAWareADC
TIVA Ware Example 4 setup
3.3V
Tiva C
PE3 Pot
GND
Example ADC Code
1. Set up clock for 40 MHz