Professional Documents
Culture Documents
MSP430 Adc
MSP430 Adc
MSP430 Adc
---PRASANNA KUMAR M
001
010
111
MSP430 ADC
Features:
• MSP430F5529 has 12-bit ADC
• 16 individually configurable input channels : 12 external input channels
and 4 internal input channels.
• Has Internal Temperature Sensor
• On-chip reference voltage generator called REF module that can
generate accurate voltage references 1.5V, 2.0V and 2.5V reference
voltages
• 4 clock source(ADCOSC,ACLK,MCLK,SMCLK) available for ADC
• Sample-and-hold circuitry offers programmable sampling periods via
timers or software.
• 16 Result register; one for each channel.
MSP430 ADC
MSP430F5529 has 12- Software configurable
bit ADC, which converts Reference Voltage
analog input to 12-bit generator(1.5/2.0/2.5V)
Digital Value. for accurate conversion.
MSP430F5529 has 16
Analog Input Channel There are 4 clock source
12- External available ADC module
4 – Internal which is software
Any one of the Analog selectable.
source can be selected
for the conversion.
Sample-and-hold
MSP430F5529 has circuitry offers
Internal Temperature programmable sampling
sensor, is one of the periods via timers or
internal analog input software
source
16 Result Registers; the 12 bit Digital
output are available in these registers;
one for each of the channel
MSP430 ADC Registers
1.0) ADC12MCTL0:ADC12_A Memory
Control 0
Using this register we can select the
Analog input channel.
• In the program, we have selected
Channel-0 (Analog Input-0 A0 pin)
• Analog input Pin A0 is multiplexed with
P6.0
ADC12MCTL0 = 0x00;
ADC12CTL1 = ADC12SHP;
MSP430 ADC Registers
2.1) ADC12CTL0:ADC Control Register-0
• Enable ADC
• Start Conversion
ADC12CTL0 |= ADC12ENC;
ADC12CTL0 |= ADC12SC;
MSP430 ADC Registers
3.1) ADC12CTL1:ADC Control Register-1
To convert analog input to Digital, ADC
Will take some time;
So, Wait for conversion to get over
4) ADC12MEM0
-- Conversion Memory Register
of channel – 0 (A0)
• After A/D conversion, 12bit Digital
Value will be in this Register.
MSP430 ADC Program example
3.3V
P1.0
P6.0/A0
2 V
5K Pot
Pot + MSP430F5529
Pot -
ADC
Resolution = Vref/ 2N
3.3V/212 4096
Digital Value(in Decimal)
= 0.00080566V Reference Voltage = 3.3 V
N = 12 Bit
MSP430 ADC Program example
#include <msp430f5529.h> Configure P6.0 for analog
Start conversion input A0 function
unsigned int value_adc=0;
int main(void)
{ Configure P1.0 as O/P Pin
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
while (1)
{
ADC12CTL0 |= ADC12SC; // Start sampling/conversion
while (ADC12CTL1 & ADC12BUSY)
{
__no_operation(); // Could just leave body of loop empty
}
value_adc=ADC12MEM0; // Read the result in ADC12MEM0 to variable value_adc
if(value_adc>=512)
P1OUT |= BIT0; // P1.0 = 1 Switch ON LED if value_adc is greater than 512
else
P1OUT &= ~BIT0; // P1.0 = 0 Switch OFF LED if value_adc is lesser than 512
}
}
MSP430 Demo
Thank you