Hello ,
I am working on MSP430FR4133 launch pad"s ADC. i have trying to read single channel its working fine with ADC channel A8 but when i am tried to work with sequential A7 and A8 using Sequence-of-channels and Repeat-sequence-of-channels mode using ADCSC bit as ADC sample-and-hold source its not working.i am giving constant 0.50 Vdc to pin no P8.0 And P1.7 which are A8 and A7 respectively are giving random value which i have pasted in image.as i am expecting around 342 decimal count because ref is 1.5V internal and 10 bit ADC.
circuit configurations are ground is shorted and common 0.5V is directly fed to the ADC channel through voltage divider and a low pass RC filter which value is 100 ohms and 2.2uF cap.
one more thing i have tried is that i had make one voltage divider array which out put is varies between 0 to 1.25V with step of 125mV using 10 step rotary switch.with this configuration i have use single channel and i am getting step of 84~85 decimal count when i am switching rotary switch which is exactly right but same configuration will not work for multiple channel.
my code is follow
#include <msp430.h>
int ADC_Result[2]; //10bit ADC conversion result array
unsigned char i;
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop WDT
// Configure ADC A7~8 pins
SYSCFG2 |= ADCPCTL8 | ADCPCTL7 ;
// Disable the GPIO power-on default high-impedance mode to activate
// previously configured port settings
PM5CTL0 &= ~LOCKLPM5;
// Configure ADC
ADCCTL0 |= ADCSHT_2 | ADCMSC | ADCON; // 16ADCclks, MSC, ADC ON
ADCCTL1 |= ADCSHP | ADCCONSEQ_1; // ADC clock MODCLK, sampling timer, s/w trig.,single sequence
ADCCTL2 |= ADCRES; //10bit conversion results
ADCMCTL0 |= ADCINCH_8 | ADCSREF_1; // A7~8(EoS); Vref=1.5V
ADCIE |= ADCIE0; // Enable ADC conv complete interrupt
// Configure reference
PMMCTL0_H = PMMPW_H; // Unlock the PMM registers
PMMCTL2 |= INTREFEN; // Enable internal reference
__delay_cycles(400); // Delay for reference settling
__no_operation();
while(1)
{
i = 1;
while(ADCCTL1 & ADCBUSY); // Wait if ADC core is active
ADCCTL0 |= ADCENC | ADCSC; // Sampling and conversion start
__bis_SR_register(GIE);
__no_operation(); // Only for debugger
__delay_cycles(5000);
__no_operation();
}
}
// ADC interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=ADC_VECTOR
__interrupt void ADC_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(ADC_VECTOR))) ADC_ISR (void)
#else
#error Compiler not supported!
#endif
{
switch(__even_in_range(ADCIV,ADCIV_ADCIFG))
{
case ADCIV_NONE:
break;
case ADCIV_ADCOVIFG:
break;
case ADCIV_ADCTOVIFG:
break;
case ADCIV_ADCHIIFG:
break;
case ADCIV_ADCLOIFG:
break;
case ADCIV_ADCINIFG:
break;
case ADCIV_ADCIFG:
ADC_Result[i] = ADCMEM0;
if(i == 0)
{
}
else
{
i--;
}
ADCIFG = 0;
break;
default:
break;
}
}
this is the same code which are present in sample code only change is that i have changed ADC channel and remove LPM mode
