ECE382 Lesson 35: Analog to Digital Conversion and ADC Process Overview

ece382 lesson 35 n.w
1 / 24
Embed
Share

Explore the fundamentals of Analog to Digital Conversion (ADC) in ECE382 Lesson 35, understanding the process of sampling, quantizing, and encoding signals. Witness how digital representation deviates from analog, with insights on resolution, sampling, and more. Delve into ADC example code, learning to interpret input voltage levels and control LED outputs for experimentation and adjustment. Elevate your understanding of integrity, service, and excellence in signal processing.

  • ECE382
  • Analog to Digital Conversion
  • ADC Process
  • Signal Processing
  • Digital Representation

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. ECE382 Lesson 35 I n t e g r i t y - S e r v i c e - E x c e l l e n c e 1

  2. Overview Lesson Outline Analog to Digital Converter (ADC) Discrete signal out (data is parallel) Continuous signal in Note how the digital representation isn t a perfect copy of the analog signal I n t e g r i t y - S e r v i c e - E x c e l l e n c e

  3. BLUF 3 steps in the Analog to Digital Conversion (ADC) Process: 1. Sample (snapshot in time) 2. Quantize (assign voltage level) 3. Encode (convert to bits) Sampling (time) and Resolution (voltage) are independent I n t e g r i t y - S e r v i c e - E x c e l l e n c e 3

  4. ADC 1. 2. 3. Sampling: Snapshots at discrete times (x-axis) Quantization: Round to discrete voltage levels (resolution)(y-axis) Encoding: convert decimal levels to binary (convert to bits) Encode in 5 bits: 10011 D Digital Analog Resolution Sampling What does the computer assume between samples? I n t e g r i t y - S e r v i c e - E x c e l l e n c e

  5. What is Your Class Score? Sample At Prog or Final? Every 5 lessons? Quantize Encode I n t e g r i t y - S e r v i c e - E x c e l l e n c e

  6. ADC10 Inputs MSP430G2553 has 8 inputs or channels I n t e g r i t y - S e r v i c e - E x c e l l e n c e

  7. ADC Example Code // TI example code #include <msp430g2553.h> void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT ADC10CTL0 = ADC10SHT_3 + ADC10ON + ADC10IE; // ADC10ON, interrupt enabled ADC10CTL1 = INCH_4; // input A4 ADC10AE0 |= BIT4; // P1.4 ADC Analog enable ADC10CTL1 |= ADC10SSEL1|ADC10SSEL0; // Select SMCLK P1DIR |= 0x01; // Set P1.0 to output direction Setup Sample, Quantize, and Encode Read Encoded Value while (1) { ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start __bis_SR_register(CPUOFF + GIE); // LPM0, ADC10_ISR will force exit if (ADC10MEM < 0x1FF) P1OUT &= ~0x01; // Clear P1.0 LED off else P1OUT |= 0x01; // Set P1.0 LED on } } // ADC10 interrupt service routine #pragma vector=ADC10_VECTOR __interrupt void ADC10_ISR(void) { __bic_SR_register_on_exit(CPUOFF); // Clear CPUOFF bit from 0(SR) } This just turns an LED on or off based on the input voltage level for Lab4 you will adjust a PWM signal based on an input voltage I n t e g r i t y - S e r v i c e - E x c e l l e n c e

  8. ADC10CTL0 ADC10CTL0 = ADC10SHT_3 + ADC10ON + ADC10IE; // ADC10ON, interrupt enabled ADC10CTL1 = INCH_4; ADC10AE0 |= BIT4; ADC10CTL1 |= ADC10SSEL1|ADC10SSEL0; P1DIR |= 0x01; // input A4 // P1.4 ADC Analog enable // Select SMCLK // Set P1.0 to output direction I n t e g r i t y - S e r v i c e - E x c e l l e n c e

  9. ADC10CTL0 Register Cont. I n t e g r i t y - S e r v i c e - E x c e l l e n c e

  10. ADC10CTL1 ADC10CTL0 = ADC10SHT_3 + ADC10ON + ADC10IE; // ADC10ON, interrupt enabled ADC10CTL1 = INCH_4; ADC10AE0 |= BIT4; ADC10CTL1 |= ADC10SSEL1|ADC10SSEL0; P1DIR |= 0x01; // input A4 // P1.4 ADC Analog enable // Select SMCLK // Set P1.0 to output direction I n t e g r i t y - S e r v i c e - E x c e l l e n c e

  11. ADC10CTL1 Register Cont. Note: Port 1: analog muxed Port 2: timer muxed I n t e g r i t y - S e r v i c e - E x c e l l e n c e

  12. ADC10AE0 Register ADC10CTL0 = ADC10SHT_3 + ADC10ON + ADC10IE; // ADC10ON, interrupt enabled ADC10CTL1 = INCH_4; ADC10AE0 |= BIT4; ADC10CTL1 |= ADC10SSEL1|ADC10SSEL0; P1DIR |= 0x01; // input A4 // P1.4 ADC Analog enable // Select SMCLK // Set P1.0 to output direction I n t e g r i t y - S e r v i c e - E x c e l l e n c e

  13. ADC10CTL1 ADC10CTL0 = ADC10SHT_3 + ADC10ON + ADC10IE; // ADC10ON, interrupt enabled ADC10CTL1 = INCH_4; ADC10AE0 |= BIT4; ADC10CTL1 |= ADC10SSEL1|ADC10SSEL0; P1DIR |= 0x01; // input A4 // P1.4 ADC Analog enable // Select SMCLK // Set P1.0 to output direction I n t e g r i t y - S e r v i c e - E x c e l l e n c e

  14. While Loop (Sample, Quantize, & Encode) while (1) { ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start __bis_SR_register(CPUOFF + GIE); // LPM0, ADC10_ISR will force exit if (ADC10MEM < 0x1FF) P1OUT &= ~0x01; // Clear P1.0 LED off else P1OUT |= 0x01; // Set P1.0 LED on } } I n t e g r i t y - S e r v i c e - E x c e l l e n c e

  15. ADC10 Inputs I n t e g r i t y - S e r v i c e - E x c e l l e n c e

  16. Successive-approximation- register(SAR) https://www.maximintegrated.com/en/app- notes/index.mvp/id/1080 As the name implies, the SAR ADC basically implements a binary search algorithm. Therefore, while the internal circuitry may be running at several megahertz (MHz), the ADC sample rate is a fraction of that number due to the successive-approximation algorithm. I n t e g r i t y - S e r v i c e - E x c e l l e n c e

  17. Clocks SMCLK and ADC10DIVx drive our sampling rate and influence ADC10SHTx for they are not independant I n t e g r i t y - S e r v i c e - E x c e l l e n c e

  18. While Loop (Disable CPU for Low Power) while (1) { ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start __bis_SR_register(CPUOFF + GIE); // LPM0, ADC10_ISR will force exit if (ADC10MEM < 0x1FF) P1OUT &= ~0x01; // Clear P1.0 LED off 10b How many bits? else P1OUT |= 0x01; // Set P1.0 LED on } } 0x3FF What is the max value? // ADC10 interrupt service routine #pragma vector=ADC10_VECTOR __interrupt void ADC10_ISR(void) (or 1023) { __bic_SR_register_on_exit(CPUOFF); // Clear CPUOFF bit from 0(SR) } I n t e g r i t y - S e r v i c e - E x c e l l e n c e

  19. While Loop (Read Encoded Input Memory) while (1) { ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start __bis_SR_register(CPUOFF + GIE); // LPM0, ADC10_ISR will force exit if (ADC10MEM < 0x1FF) P1OUT &= ~0x01; // Clear P1.0 LED off else P1OUT |= 0x01; // Set P1.0 LED on } } // ADC10 interrupt service routine #pragma vector=ADC10_VECTOR __interrupt void ADC10_ISR(void) { __bic_SR_register_on_exit(CPUOFF); // Clear CPUOFF bit from 0(SR) } I n t e g r i t y - S e r v i c e - E x c e l l e n c e

  20. LM34 Temperature Sensor 0.01*77+.5 = 1.27V At 77F, what voltage do I expect? I n t e g r i t y - S e r v i c e - E x c e l l e n c e

  21. ADC Temperature Schematic I n t e g r i t y - S e r v i c e - E x c e l l e n c e

  22. Changes to ADC10CTL0 Register for LM34 ADC10CTL0 |= SREF_1 | ADC10SHT_3 | ADC10ON | REFON | ADC10IE; // ADC10ON, interrupt enabled I n t e g r i t y - S e r v i c e - E x c e l l e n c e

  23. ADC10CTL1 Register ADC10CTL1 |= INCH_4 | ADC10DIV_7; // input ch A4, Div by 8 I n t e g r i t y - S e r v i c e - E x c e l l e n c e

  24. BACKUPS I n t e g r i t y - S e r v i c e - E x c e l l e n c e

Related


More Related Content