1 / 23

The Analog-to-Digital Converter

The Analog-to-Digital Converter. Presented by IEEE of Texas A&M. About This Workshop. Based on the MSP430G2553 microcontroller by Texas Instruments Powerpoint and code available at ieeetamu.org/mcc/ theadc Workshop Reference available at ieeetamu.org/mcc/ wsref

jens
Download Presentation

The Analog-to-Digital Converter

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 Analog-to-Digital Converter Presented by IEEE of Texas A&M

  2. About This Workshop • Based on the MSP430G2553 microcontroller by Texas Instruments • Powerpoint and code available at ieeetamu.org/mcc/theadc • Workshop Reference available at ieeetamu.org/mcc/wsref • Footnotes refer to User Guide (UG), Datasheet, or Workshop Reference (WSRef) Example: UG §1.2.3, DS §4.5.6, WSRef §7.8.9

  3. Import code projects into Code Composer • Follow instructions in the Workshop Reference or at ieeetamu.org/mcc/importing • Code: ieeetamu.org/mcc/theadc • Projects to import: • Photoresistor • Temperature WSRef § 1.2

  4. Extremely Useful Documents • User's Guide – MSP430x2xx Family • ieeetamu.org/msp430ug • All general MSP430 information • Ex: MSP430 Architecture, Instruction Set, Registers, clocks, timers, module types and functionality • MSP430G2x53 Datasheet • ieeetamu.org/msp430ds • Information specific to individual set of chips • Ex: List of included modules, pin-outs, memory size

  5. Analog-to-Digital Converter (ADC) Definition of ADC: “A device that converts a continuous physical quantity to a digital number that represents the quantity’s amplitude” - wikipedia

  6. How ADC Works Analog-to-Digital Converter Analog Signal Digital Signal “Simplified” Flowchart

  7. How ADC Works

  8. Applications of ADC Examples of analog signals that can be converted to digital signals: - Sound - Pressure - Temperature* - Light* - And more…

  9. ADC on the MSP430 • One 10 Bit ADC module • 8 channels • 50-200 kilo-samples per second

  10. ADC Temperature Example MSP430 Temperature LED Analog-to-Digital Converter Analog Signal Digital Signal

  11. ADC Temperature Example • Open/Run temperature.cpp • Placing your finger on the M430g2553 chip to increase the temperature • The red LED should begin to blink faster

  12. ADC Temperature Example #include"msp430g2553.h" staticsignedintadcStart = 0; staticsignedintcurrentDelay = 0; void main(void) { WDTCTL = WDTPW + WDTHOLD; P1DIR = BIT0; P1OUT = 0; ADC10CTL0 = SREF_1 + ADC10SHT_3 + REF2_5V + ADC10IE + REFON + ADC10ON; ADC10CTL1 = ADC10DIV_3 + INCH_10 + SHS_0 + CONSEQ_2 + ADC10SSEL_2;

  13. ADC Temperature Example • ADC10CTL0 |= ENC + ADC10SC; • while(!(ADC10IFG & ADC10CTL0)) {} • adcStart = ADC10MEM;

  14. ADC Temperature Example while(1) { ADC10CTL0 &= ~(ADC10SC); ADC10CTL0 |= ENC + ADC10SC; while(!(ADC10IFG & ADC10CTL0)) { } currentDelay= ((6 - (ADC10MEM - adcStart))); currentDelay*= currentDelay; P1OUT ^= BIT0; for(inti = 0; i < currentDelay; i++) { __delay_cycles(5000); } }

  15. Photoresistor Definition: A resistor whose resistance decreases with increasing incident light intensity Small resistance lots of light Large resistance Little light

  16. Photoresistor

  17. ADC Photoresistor Example #include"msp430g2553.h" intview_input = 0; voidmain(void) { WDTCTL = WDTPW + WDTHOLD; ADC10CTL0 = SREF_1 + REF2_5V + REFON + ADC10SHT_2 + ADC10ON + ADC10IE; ADC10CTL1 = INCH_1 ADC10AE0 |= BIT1; P1DIR |= BIT0; intADC_count = 0;

  18. ADC Photoresistor Example while(1) { P1OUT ^= BIT0; while(ADC_count< 1000) { ADC10CTL0 |= ENC + ADC10SC; while(!(ADC10IFG & ADC10CTL0)) { } ADC_count+= ADC10MEM; __delay_cycles(100000); } ADC_count= 0; }

  19. Changing the Reference Voltage

  20. Changing the Reference Voltage Reference-generator voltage. (REFON must also be set.) • REF2_5V Bit 6 • 0 1.5 V • 1 2.5 V Reference generator on • REFON Bit 5 • 0 Reference off • 1 Reference on ADC10 on • ADC10ON Bit 4 • 0 ADC10 off • 1 ADC10 on

  21. Changing the Reference Voltage Using SREF_1, and REF2_5V, try setting the reference voltage to 1.5V, 2.5V, and Vcc.

  22. Changing the Reference Voltage • Using SREF_1, and REF2_5V, try setting the reference voltage to 1.5V, 2.5V, and Vcc. ADC10CTL0 = SREF_1 + REFON + ADC10SHT_2 + ADC10ON + ADC10IE; // 1.5V ADC10CTL0 = SREF_1 + REF2_5V + REFON + ADC10SHT_2 + ADC10ON + ADC10IE;// 2.5V ADC10CTL0 = REFON + ADC10SHT_2 + ADC10ON + ADC10IE; // Vcc

  23. The Reference Voltage All ADCs need a reference voltage which an input voltage may be compared to Available for ADC10: • VCC (upper) • VSS (lower) • VEREF- (lower) (external references) • VEREF+ (upper) • VREF- (lower) (internal references) • VREF+ (upper) See 22.2.3, page 537, of user guide for details

More Related