EasyManua.ls Logo

Texas Instruments MSP430

Texas Instruments MSP430
413 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
175
ADC10CTL0 |= ENC;
ADC10CTL0 |= ADC10SC;
while ((ADC10CTL0 & ADC10IFG) == 0);
return ADC10MEM;
}
The function above first disables the momentarily and clears channel number or count. Then the
desired channel is chosen. AD conversion is started following ADC restart and we wait for AD
conversion completion. At the end of the conversion ADC result is extracted and returned.
In the main loop, we simply select channel using the Launchpad user button and display ADC data on
a LCD. For ease, I demoed ADC10 using two external channels (A1 and A2) and one internal ADC
channel the internal temperature sensor.
switch(n)
{
case 1:
{
ADC_Value = get_ADC(INCH_1);
res = get_volt(ADC_Value);
LCD_goto(0, 0);
LCD_putstr("ADC Ch01:");
LCD_goto(0, 1);
LCD_putstr("Volts/mV:");
break;
}
case 2:
{
ADC_Value = get_ADC(INCH_2);
res = get_volt(ADC_Value);
LCD_goto(0, 0);
LCD_putstr("ADC Ch02:");
LCD_goto(0, 1);
LCD_putstr("Volts/mV:");
break;
}
default:
{
ADC_Value = get_ADC(INCH_10);
res = get_temp(get_volt(ADC_Value));
LCD_goto(0, 0);
LCD_putstr("ADC Ch10:");
LCD_goto(0, 1);
LCD_putstr("TC/Deg.C:");
break;
}
}
lcd_print(12, 0, ADC_Value);
lcd_print(12, 1, res);
delay_ms(200);

Table of Contents

Other manuals for Texas Instruments MSP430

Related product manuals