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.

CCS/MSP430F2012: MSP430F2012 ADC10CTL1 register readout

Part Number: MSP430F2012
Other Parts Discussed in Thread: MSP-TS430PW14

Tool/software: Code Composer Studio

Hi,

I used a very old design using an MSP430F2012 for a new project (motor driver)

When programming the ADC10 I found that checking with the dis-assembly function in CCS the correct value gets written to the ADC10CTL1 register but it does not reads back the same value.

The ADC10CTL1 register only displays the value 0x0002, regardless what I program into it. 

According to the MSP430F2xx users guide is this a r/w register to I expect to read back what I write (as ADC10CTL0 is doing).

I use the ADC10 in a sequence of 4 channels triggered by the ADC10SC bit in the  timer-A ISR.  The timer-A ISR runs OK.

programming used to set the ADC10SC bit is: ADC10CTL0 |= ADC10SC;

The ADC10 ISR is accessed the first time and then no more so the ADC doesn't seem to generate an interrupt anymore.

Interrupt flags are not modified after init

ADC10 regs are programmed as follows

    ADC10CTL0  = (SREF_0 + ADC10SHT_1 + MSC + ADC10ON + ADC10IE + ENC);
    ADC10CTL1  = (INCH_3 + ADC10DIV_1 + ADC10SSEL_3 + CONSEQ_1);
    ADC10AE0     = 0x0F;  
    ADC10DTC0  = 0;
    ADC10DTC1  = 4;
    ADC10SA        = (unsigned int)TempValues; 

_EINT();                                                                        // enable global interrupts

ANy idea what causes this strange behaviour of ADC10CTL1 ?

ps: I ran the code on an EVM: MSP-TS430PW14

        
  

  

  • OK,

    This is a typical "read your !@#$ manual" moment

    most of the ADC10CTLn bits can only be modified when the ENC bit is cleared.

    The correct programming sequence therefore is:

        ADC10CTL0  = (SREF_0 + ADC10SHT_1 + MSC + ADC10ON + ADC10IE);
        ADC10CTL1  = (INCH_3 + ADC10DIV_1 + ADC10SSEL_3 + CONSEQ_1);
        ADC10CTL0 |= ENC;
        ADC10AE0 = (HV_in + LV_in + Pot_in + IM);
        ADC10DTC0 = 0;
        ADC10DTC1 = 4;
        ADC10SA   = (unsigned int)TempValues;

**Attention** This is a public forum