Lecture 8: Analog To Digital Converter: To Embedded Systems: Using Microcontrollers and The MSP430
Lecture 8: Analog To Digital Converter: To Embedded Systems: Using Microcontrollers and The MSP430
LECTURE 8: ANALOG TO
DIGITAL CONVERTER
Lecture
M. Jiménez, R. Palomera, & I. Couver tier Slides
Series
MSP430
ADC10
ADC10 Configuration
Internal voltage
reference control.
Don’t forget to
turn the ADC on!
Choose your
input channels.
CLOCK SOURCES
The SAR core of the MSP430G2xxx3 microcontroller can be
clocked by either ACLK, SMCLK, MCLK or by the internal
Oscillator ADC10OSC.The clock produced by the internal
oscillator ADC10OSC is in the range of 5MHz and varies with
changes in temperature and Voltage. The default clock for
ADC10 is taken from ADC10OSC .
MODES OF OPERATION
ADC10 of MSP430G2xxx can operate in 4 different modes
ADC10 INTERRUPTS
#include "msp430g2553.h"
#include "intrinsics.h"
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // stop WDT
// ADC configuration,V+ref=3V,V-ref=0V,Channel=A0
ADC10CTL0 = ADC10ON + ADC10IE; // Vref Vr+=3v,Vr-=VSS,
// S&Htime = 4 X ADCCLK,ADC10 on,ADC interrupts enabled
ADC10CTL1 = ADC10DIV_7; // INCH =0000->A0,ADCCLK src = ADC10CLK,
// ADCCLK/8,Single Channel Single Conversion
ADC10AE0 = INCH_0; // channel A0
/***************************************************************************/
/* interrupt vectors for MSP430 */
/***************************************************************************/
#pragma vector = ADC10_VECTOR
__interrupt void adc10_interrupt(void)
{
ADC10CTL0 |= ENC + ADC10SC; // Start Conversion again
}