Part Number: MSP430FR2311
Hello,,
i am using MSP430FR2311 microcontroller... 10 bit ADC
anyone can tell me how to calculate the sampling frequency.....??
when i can achieve maximum conversion rate 200ksps....?
wright now i have configured adc ... clock = MODOSC
SAMPLING TIME = 16 ADC10CLK CYCLES
REF : 1.5VREF + VSS (INTERNAL REFERENCE)
RESOLUTION : 10 BIT
right Now i'm achieving only 23.86 Ksps
i have attached my code... if there is any mistake please notify me.... thank you all
My Code:
int main(void)
{
P1DIR |= BIT0;
// Configure ADC A1 pin
P1SEL0 |= BIT1;
P1SEL1 |= BIT1;
PM5CTL0 &= ~LOCKLPM5;
// Configure ADC10
ADCCTL0 |= ADCSHT_2 | ADCON; // ADCON, S&H=16 ADC clks
ADCCTL1 |= ADCSHP; // ADCCLK = MODOSC; sampling timer
ADCCTL2 |= ADCRES; // 10-bit conversion results
ADCMCTL0 |= ADCINCH_1 | ADCSREF_1; // A1 ADC input select; 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
while(1)
{
ADCCTL0 |= ADCENC | ADCSC; // Sampling and conversion start
__bis_SR_register(GIE); // LPM0, ADC_ISR will force exit
}
}
// 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:
P1DIR ^= BIT0;
break;
default:
break;
}
}