1 / 19

The Silicon Laboratories C8051F020

The Silicon Laboratories C8051F020. Enhanced 8051 Part 4 Analog to Digital Conversion (ADC). Analog to Digital Conversion. V. Digital value. 01111110. 10110000. 10111110. 01111100. 11111110. 11101110. 11111110. 01110000. 01111110. time. time. Analog. A/D Converter.

Download Presentation

The Silicon Laboratories C8051F020

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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 V Digital value 01111110 10110000 10111110 01111100 11111110 11101110 11111110 01110000 01111110 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. 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. 100000000000 110000000000 101000000000 ..... Example... first 3 bits 110000000000 analog 101000000000 100000000000 ECE/CS-352: Embedded Microcontroller Systems

  6. Analog to Digital ConversionPrecision Analog Digital n A/D Converter 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 4 Volts .25 V/bit Precision: 16 values ECE/CS-352: Embedded Microcontroller Systems

  7. 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. 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. 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 0 = 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 ADC0CN 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. 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: 0-0.01V • Use max gain of 16 (so range is 0-0.16V) • VREF from DAC0 or external, 0.16V) ECE/CS-352: Embedded Microcontroller Systems

  16. 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. ADC0 Example Data Conversion: Gain = 4 VREF = 2.0V Note: Vin limited to range of -.5V to +.5V n = 12 for single-ended inputs, n = 11 for differential Values are sign-extended. ECE/CS-352: Embedded Microcontroller Systems

  18. Conversion Calculations 0 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. Become AD Converts.... ECE/CS-352: Embedded Microcontroller Systems

More Related