Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Silicon Laboratories C8051F020

Similar presentations


Presentation on theme: "The Silicon Laboratories C8051F020"— Presentation transcript:

1 The Silicon Laboratories C8051F020
Enhanced 8051 Part 4 Analog to Digital Conversion (ADC) ECE/CS-352: Embedded Microcontroller Systems

2 Analog to Digital Conversion
Digital value time time Analog A/D Converter Digital (8-bit) GND ECE/CS-352: Embedded Microcontroller Systems

3 Analog to Digital Conversion
DAC n Basic idea is to compare analog input to value produced by DAC and use logic to adjust the digital output so that it properly represents the analog input. A/D converters classified based on what logic is used. ECE/CS-352: Embedded Microcontroller Systems

4 ECE/CS-352: Embedded Microcontroller Systems
Counting Converter DAC n Count from 0 to 2n, when DAC output is higher than Input, then flag changes. ECE/CS-352: Embedded Microcontroller Systems

5 Successive Approximation
DAC n Starting at MSB, set each bit to 1, and if it trips the comparator, reset to 0. If not, hold at 1. Repeat for all bits. ..... Example... first 3 bits analog ECE/CS-352: Embedded Microcontroller Systems

6 Analog to Digital Conversion Precision
A/D Converter n Analog Digital Analog 0.00 0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00 2.25 2.50 2.75 3.00 3.25 3.50 3.75 4.00 Digital 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 Examples: Analog Range: 0V-4V Digital: n=4 Precision: 4 Volts 16 values .25 V/bit ECE/CS-352: Embedded Microcontroller Systems

7 ECE/CS-352: Embedded Microcontroller Systems
C8051F020 A/D Converters ADC0 12-bit Successive Approximation (SAR) 100ksps (kilo-samples per second) ADC1 8-bit SAR 500ksps ECE/CS-352: Embedded Microcontroller Systems

8 ECE/CS-352: Embedded Microcontroller Systems
ADC0 Analog source options SFRs Reference voltage options Conversion sync options ECE/CS-352: Embedded Microcontroller Systems

9 AMX0CF – AMUX0 Configuration Register
Differential pair inputs: + - V V can be positive or negative 0 – single-ended analog inputs 1 – differential pairs AMX0CF ECE/CS-352: Embedded Microcontroller Systems

10 AMX0SL – AMUX0 Channel Select Register
AMUX0 address bits What is MUXed in depends on AMUX0CF AMX0SL ECE/CS-352: Embedded Microcontroller Systems

11 ECE/CS-352: Embedded Microcontroller Systems
AMUX0SL Possibilities ECE/CS-352: Embedded Microcontroller Systems

12 ADC0CF – ADC0 Configuration Register
Bit7-Bit3: SAR Conversion Clock Period Bits Bit2-Bit0: Internal Amplifier Gain 000: Gain = 1 001: Gain = 2 010: Gain = 4 011: Gain = 8 10x: Gain = 16 11x: Gain = 0.5 ADC0CF ECE/CS-352: Embedded Microcontroller Systems

13 ADC0CN – ADC0 Control Register
AD0EN = disabled 1 = enabled AD0TM Track mode bit (low power mode) AD0INT (must be cleared by software) 0 = conversion not completed 1 = conversion has been completed AD0BUSY 0 = conversion not in progress 1 = conversion in progress ADC0CN ECE/CS-352: Embedded Microcontroller Systems

14 ADC0CN – ADC0 Control Register
Bit3-2: ADC0 Start of Conversion Mode Select. If AD0TM = 0 (tracking mode on): 00: ADC0 conversion initiated on every write of ‘1’ to AD0BUSY. 01: ADC0 conversion initiated on overflow of Timer 3. 10: ADC0 conversion initiated on rising edge of external CNVSTR. 11: ADC0 conversion initiated on overflow of Timer 2. If AD0TM = 1: Same as above except conversion takes 3 SAR clock cycles longer Bit1: ADC0 Window Compare Interrupt Flag. This bit must be cleared by software. 0: ADC0 Window Comparison Data match has not occurred since this flag was last cleared. 1: ADC0 Window Comparison Data match has occurred. Bit0: ADC0 Left Justify Select. 0: Data in ADC0H:ADC0L registers are right-justified. 1: Data in ADC0H:ADC0L registers are left-justified. ECE/CS-352: Embedded Microcontroller Systems

15 ECE/CS-352: Embedded Microcontroller Systems
Selecting VREF, Gain Maximum VREF = 3.3V (Vdd) Suppose analog range is about 0-3V No Gain needed External VREF of 3V 0r Gain = .5 (so analog range becomes 0-1.5V) VREF from DAC0 of 1.5V Suppose analog range is low: V Use max gain of 16 (so range is V) VREF from DAC0 or external, 0.16V) ECE/CS-352: Embedded Microcontroller Systems

16 ECE/CS-352: Embedded Microcontroller Systems
ADC0 Example + - Vin 2.0V Differential input (can be negative or positive) on AIN0 and AIN1 (channel select AIN0) Convert on timer 2 overflow Amplify by 4 Right justified data Interrupt each conversion External Vref = 2.0V ECE/CS-352: Embedded Microcontroller Systems

17 ECE/CS-352: Embedded Microcontroller Systems
ADC0 Example Data Conversion: Gain = 4 VREF = 2.0V Note: Vin limited to range of -.5V to +.5V Vin ADC0H: ADC0L +.5V 07FFh : +.25V 0400h : 0000h : -.25V FC00h : -.5V F800h : n = 12 for single-ended inputs, n = 11 for differential Values are sign-extended. ECE/CS-352: Embedded Microcontroller Systems

18 Conversion Calculations
analog range Vref – 1 lsb 000h digital range FFFh (4095) There are 4096 different digital values corresponding to 0-Vref. Find the voltage per least significant bit: Now find analog value corresponding to some digital value Xd ECE/CS-352: Embedded Microcontroller Systems

19 ECE/CS-352: Embedded Microcontroller Systems
Become AD Converts.... ECE/CS-352: Embedded Microcontroller Systems


Download ppt "The Silicon Laboratories C8051F020"

Similar presentations


Ads by Google