This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADC10 Mode Repeat single channel

Other Parts Discussed in Thread: MSP430G2553

Hello All

I am currently using the MSP430 Launchpad which houses a MSP430G2553.

I am using Code Composer studio to To Compile and Debug.

I am currently struggling to implement the ADC10 Mode Repeat single channel

The Problem that i am facing are:

After downloading the debug code and when I hit run I get the following Error

MSP430: Trouble Reading Memory Block at 0x3fe on Page 0 of Length 0x2: Could not determine device state
MSP430: Trouble Reading Memory Block at 0xc442 on Page 0 of Length 0x11: No error
MSP430: Trouble Reading Memory Block at 0xc442 on Page 0 of Length 0x5d: No error
MSP430: Trouble Reading Memory Block at 0x3fe on Page 0 of Length 0x2: No error

Not sure why this is happening.

And sometimes I am even unable to download the code on the the Micro controller.

For some reason I am unable to collect the average data and I am unable to put break points as well in the ADC code

Please find below the ADC Initialise in Function

/****************************************************************************
    ADC_Init                Initialise the ADC to measure input voltage
*****************************************************************************
****************************************************************************/

VOID_T                       ADC_Init       
    (   VOID_T
       )
{
    // Initialise variables
    // reset the buffer count
    ADCInt.avgcnt = 0;
    ADCInt.avgResult = 0;
    ADCInt.val = 0;

    // Repeat single channel and input A5 and
    ADC10CTL1 = CONSEQ_2+ INCH_5;

    // VR+ = VREF+ and VR- = AVSS, ADC10ON, 16 x ADC10CLKs, ADC10 Reference on,
    // ADC10 Ref 1:2.5V, ADC10 On/Enable,  ADC10 Interrupt Enable and Multiple Sample Conversion
    ADC10CTL0 = SREF_1 + ADC10SHT_2 + MSC + REFON + REF2_5V + ADC10ON + ADC10IE ;

    // PA.5 ADC option select
    ADC10AE0 |= BIT_5;
}

/****************************************************************************
    ADC_Start                Start The ADC Conversion
*****************************************************************************
****************************************************************************/

VOID_T                       ADC_Start       
    (   VOID_T
       )
{
    // reset the buffer count
    ADCInt.avgcnt = 0;
    // Sampling and conversion start
    ADC10CTL0 |= ENC + ADC10SC;             
}

/****************************************************************************
    ADC_ISR                    ADC Interrupt Routine
*****************************************************************************
****************************************************************************/
#pragma vector=ADC10_VECTOR

__interrupt VOID_T           ADC_ISR       
    (   VOID_T
       )
{
    // update the adcval
    ADCInt.val+ = ADC10MEM;

    if(++ADCInt.avgcnt > ADC_AVG_MAX)
    {
        // reset the avg count
        ADCInt.avgcnt = 0;

        ADCInt.avgResult = (ADCInt.val/ADC_AVG_MAX);

        // Disable the conversion
        ADC10CTL0 &= ~ENC;
    }
}

From the Above code what i was expecting that that on the ADC Start it sample 10 (ADC_AVG_MAX) ADC reading repeatedly and stop and then we can average.

In Single channel single-conversion mode I don't face these problem.

Please advice if i am doing anything wrong.

Thanks and Regards

Anthony

**Attention** This is a public forum