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.

MSP430F5419A: ADC12 Interrupt Not Occurring

Part Number: MSP430F5419A
Other Parts Discussed in Thread: MSP430F5438A

The 12-bit completion interrupt does not always occur. Normally once the ADC conversion is started the ADC completes the conversion and issues the interrupt. On this device, the interrupt fails to occur some of the time and becomes 'stuck'. A delay of several orders of magnitude before clearing the trigger (ADC12SC) appears to be the only way to get the ADC 'unstuck'. Thank you for any help you can provide in resolving this issue. 

  • I find it interesting that your workaround includes explicitly turning off the ADCSC bit, since normally that turns off by itself. I have seen ADCSC stuck on, but only when it was set while ENC=0 (including if ADC12ON=0).

    Without seeing your code it is difficult to guess how this would come about.

    You may also want to check Erratum ADC42, where the ADC freezes if you start a conversion while a conversion is already in progress [Ref Errata sheet (SLAZ282AB) p. 6]

  • Hi. Thank you for your response. Our application runs the ADC timer off of ACLK @ 32kHz. Our sample and hold time is 32 cycles or approximately 1 msec. I believe that 12 clocks are needed per conversion cycle. This would be 366us. The total time needed should be no more than 2 msec per channel. The total number of channels being converted are two - 4msec. The first conversion is triggered on startup. Then we wait 100ms before another conversion is triggered. After that, we would trigger the conversions every 4 seconds. On three boards we are seeing that the second conversion does not trigger. All other boards we have shipped (150+) do not show this issue. 

    We are checking the busy flag before triggering another conversion. We do not set ADC12ENC = 0 after completing a conversion. I do not understand why adding a 50ms delay after the ADC12 interrupt has triggered and then setting ADC12ON = 0 and ADC12SC = 0 appears to avoid this issue. Is there a timing window after the ADC12 interrupt has occurred when the ADC12SC  and ADC12SC must be cleared before a new conversion can take place? Thanks for your help.

    Here is our configuration:

    1. Initialize ADC12 code:


    initAdc(){
    // REFON must be on to configure the device. It can then be turned off.
    REFCTL0 = ( REFMSTR // REF is controlled by its own bits and not by the legacy ADC bits
    | REFVSEL_3 // Set REF to 2.5v
    | REFON // Must be set during configuration
    );

    P6SEL = ADC_IN_3; // P6.3 ADC Mode 

    ADC12CTL0 = ( ADC12SHT1_15 // S&H time for channels 8 -15 is 32 clocks (1 msec)
    | ADC12SHT0_15 // S&H time for channels 0 - 7 is 32 clocks (1 msec)
    | ADC12MSC
    | ADC12ON); // Turn ADC on.

    ADC12CTL1 = ( ADC12CSTARTADD_0 // Start with conversion memory 0
    | ADC12SHS_0 // S&H initiated by ADC12SC bit in ADC12CTL0
    | ADC12SHP // S&H ended by a timer
    | ADC12DIV_0 // ADC12 clock divided by 1
    | ADC12SSEL_1 // ADC12 clock source is ACLK
    | ADC12CONSEQ_1); // ADC12 convert a sequence of channels

    ADC12CTL2 = (ADC12TCOFF // Internal temp sensor off. Will turn on when needed
    | ADC12RES_2 // 12-bit resolution
    | ADC12SR); // Sample rate < 50ksps

    ADC12MCTL0 = ( ADC12SREF_1 // use VREF+ and AVSS for reference
    | ADC12INCH_3); // Input channel 3 (battery voltage / 11 )

    ADC12MCTL1 = (ADC12EOS // End of Sequence - this is the last register in the sequence
    | ADC12SREF_1 // use VREF+ and AVSS for reference
    | ADC12INCH_10); // Input channel 10 (temp sensor)

    ADC12IE = ADC12IE0; // Get an interrupt after completing the first (and only) conversion (VCC)

    ADC12CTL0 |= ADC12ENC; // Configuration of ADC12 requires ADC12ENC =0

    adcInProgress = 0;
    REFCTL0 &= ~REFON;
    REFCTL0 |= REFTCOFF;
    }

    2. adcStart() - this routine is typically scheduled every 4 seconds to begin a new conversion.

    a. check if ADC is busy 

    b. REFCTL0 |= REFON //Turn on reference for temperature sensor

       REFCTL0 &= ~REFTCOFF //Turn on temperature sensor

       ADC12CTL0 |= ADC12ON | ADC12SC //Turn on ADC and start conversion

    3. When conversion interrupt occurs:

       a. Grab ADC12MEM0 reading

       b. Grab ADC12MEM1 reading

       c. ADC12CTL0 &= ~(ADC12ON | ADC12SC) //turn off ADC and clear the trigger

       d. REFCTL0 &= ~REFON

       e. REFCTL0 |= REFTCOFF  

  • > | ADC12SHT0_15 // S&H time for channels 0 - 7 is 32 clocks (1 msec)

    SHT0=15 is 1024 clocks, so each conversion is about 33ms. [Ref UG (SLAU208Q) Table 28-4]

    -------------------------------------------------------------------------------------- 

    >ADC12MCTL1 = (ADC12EOS // End of Sequence - this is the last register in the sequence

    > ADC12IE = ADC12IE0; // Get an interrupt after completing the first (and only) conversion (VCC)

    You're using CONSEQ=1 and MSC=1, so each SC will do 2 conversions, total 66ms. The completion interrupt will happen after the first conversion, 33ms before the ADC really finishes its work. You won't hear anything when the second completes.

    -------------------------------------------------------------------------------------- 

    > a. check if ADC is busy 

    How are you doing this exactly?

    -------------------------------------------------------------------------------------- 

    >   ADC12CTL0 &= ~(ADC12ON | ADC12SC) //turn off ADC and clear the trigger

    This is almost certainly executed when the ADC is still running. Since it doesn't set ADC12ENC=0, the ADC will continue to run. (Also, I'm pretty sure you can't set ADC12ON=0 when ADC12ENC=1.)

    -------------------------------------------------------------------------------------- 

    My suspicion is that due to the premature interrupt you're issuing another SC before the ADC completes. Your 50ms delay allows the (second) conversion to complete. I suggest:

    1) Use ADC12IE1 instead of ADC12IE0, so you get the whole sequence.

    2) From your description, you wanted SHT0=3, not =15

  • Hi Bruce. Thank you for pointing out the S&H time and your suggestions. I tried what you suggested, triggering off the final conversion(ADC12IE1), but that didn't work for me. In the code, conversion memory 0 and 1 are not read at the same time as it appears in my outline above. 

    To be sure that the time difference between readings was sufficient, I added a delay corresponding to the S&H time (33msec) between the first conversion complete interrupt (ADC12IE0), and the second conversion before reading the second conversion register (ADC12MCTL1). I found that I still couldn't get another conversion sequence to occur. If I double this time (66msec) I can trigger another conversion however, I am getting conversion errors. This leads me to believe that I am still missing every other conversion due to a timing issue with the ADC hardware itself. 

    I also attempted to reduce the sample and hold time as you suggested to 1msec and still observe the same behavior. Disabling the ADC  with (ADC12ENC = 0 and ADC12ON = 0) as recommended in the errata doesn't seem to help. 

    To answer your question about ADCBUSY I check with the following line prior to starting another conversion to allow it to finish:

    if (ADCCTL1 & ADCBUSY) {

    //set a diagnostic marker

    return;

    }

    Do you know how many clock cycles after the first conversion interrupt has occurred, a read from the first conversion result register takes? I realize adding a delay may have a tolerance in any case due to clocks, etc - but there should be some margin - that is the part that I am hoping to get an answer for :)

    Thanks.

  • >  triggering off the final conversion(ADC12IE1), but that didn't work for me. 

    In what way didn't it work?

    > In the code, conversion memory 0 and 1 are not read at the same time 

    When they're read isn't so important as the fact that they're always converted together.

    > Do you know how many clock cycles after the first conversion interrupt has occurred, a read from the first conversion result register takes? 

    I'm not sure I understand the question. UG (SLAU208Q) Fig 28-8 indicates that it takes 1 ADC clock to store the MEM register and set the IFG. The contents of the MEM register are then available to the CPU (with no delay).

    I guess I'm still concerned that the code above routinely turns off ADCSC while the ADC is running. I've never (intentionally) turned off ADCSC explicitly, so I don't know how long it stays on, but doing that is at best unnecessary. What happens when you don't do that?

  • Hi 

    Could you share a sample project that can reproduce the issue on your failed board to me?(Please make it as sample as possible)

    I know you have run some demo code from TI, have you reproduce the issue? Which demo do you use?

    Dose this issue have 100% on the failed board?

    Could you share me your schematic? If it not allow be public, you can send it just to my private email(garygao@ti.com)

    Best regards

    Gary

  • Hi Anthony

    I have create a project that can get analog signal at GPIO and the on chip temperature sensor. I have test it on msp430f5438a. You can change it with your hardware just the analog input GPIO is enough. Could you help me to see if any problem with this code?

    msp430x54xA_adc12_09.c
    /* --COPYRIGHT--,BSD_EX
     * Copyright (c) 2012, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
     *******************************************************************************
     * 
     *                       MSP430 CODE EXAMPLE DISCLAIMER
     *
     * MSP430 code examples are self-contained low-level programs that typically
     * demonstrate a single peripheral function or device feature in a highly
     * concise manner. For this the code may rely on the device's power-on default
     * register values and settings such as the clock configuration and care must
     * be taken when combining code from several examples to avoid potential side
     * effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware
     * for an API functional library-approach to peripheral configuration.
     *
     * --/COPYRIGHT--*/
    //******************************************************************************
    //  MSP430F543xA Demo - ADC12_A, Sequence of Conversions (non-repeated)
    //
    //  Description: This example shows how to perform A/D conversions on a sequence
    //  of channels. A single sequence of conversions is performed - one conversion
    //  each on channels A0, A1, A2, and A3. Each conversion uses AVcc and AVss for
    //  the references. The conversion results are stored in ADC12MEM0, ADC12MEM1,
    //  ADC12MEM2, and ADC12MEM3 respectively and are moved to 'results[]' upon
    //  completion of the sequence. Test by applying voltages to pins A0, A1, A2,
    //  and A3, then setting and running to a break point at the "_BIC..."
    //  instruction in the ISR. To view the conversion results, open a watch window
    //  in debugger and view 'results' or view ADC12MEM0, ADC12MEM1, ADC12MEM2, and
    //  ADC12MEM3 in an ADC12 SFR window.
    //  This can run even in LPM4 mode as ADC has its own clock
    //  Note that a sequence has no restrictions on which channels are converted.
    //  For example, a valid sequence could be A0, A3, A2, A4, A2, A1, A0, and A7.
    //  See the 5xx User's Guide for instructions on using the ADC12.
    //
    //                MSP430F5438A
    //             -----------------
    //         /|\|                 |
    //          | |                 |
    //          --|RST              |
    //            |                 |
    //    Vin0 -->|P6.0/A0          |
    //    Vin1 -->|P6.1/A1          |
    //    Vin2 -->|P6.2/A2          |
    //    Vin3 -->|P6.3/A3          |
    //            |                 |
    //
    //   M Morales
    //   Texas Instruments Inc.
    //   June 2009
    //   Built with CCE Version: 3.2.2 and IAR Embedded Workbench Version: 4.11B
    //******************************************************************************
    
    #include <msp430.h>
    
    
    #define CALADC12_15V_30C  *((unsigned int *)0x1A1A)   // Temperature Sensor Calibration-30 C
                                                          //See device datasheet for TLV table memory mapping
    #define CALADC12_15V_85C  *((unsigned int *)0x1A1C)   // Temperature Sensor Calibration-85 C
    
    unsigned int temp;
    volatile float temperatureDegC;
    volatile float temperatureDegF;
    
    volatile unsigned int results[4];           // Needs to be global in this example
                                                // Otherwise, the compiler removes it
                                                // because it is not used for anything.
    
    int main(void)
    {
      WDTCTL = WDTPW+WDTHOLD;                   // Stop watchdog timer
      
      P6SEL = 0x80;                             // Enable A/D channel 3 inputs
    
      /* Initialize the shared reference module */
      REFCTL0 |= REFMSTR + REFVSEL_0 + REFON;    // Enable internal 2.5V reference
      /* Initialize ADC12_A */ 
      ADC12CTL0 = ADC12ON+ADC12MSC+ADC12SHT0_8; // Turn on ADC12, set sampling time
      ADC12CTL1 = ADC12SHP+ADC12CONSEQ_1;       // Use sampling timer, single sequence
      ADC12MCTL0 = ADC12SREF_1+ADC12INCH_7;                 // ref+=AVcc, channel = A0
      ADC12MCTL1 = ADC12SREF_1+ADC12INCH_10+ADC12EOS;                 // ref+=AVcc, channel = A1
     // ADC12MCTL2 = ADC12INCH_2;                 // ref+=AVcc, channel = A2
    //  ADC12MCTL3 = ADC12INCH_3;        // ref+=AVcc, channel = A3, end seq.
      ADC12IE = ADC12IE1;                           // Enable ADC12IFG.3
      ADC12CTL0 |= ADC12ENC;                    // Enable conversions
    
      while(1)
      {
        ADC12CTL0 |= ADC12SC;                   // Start convn - software trigger
        
        __bis_SR_register(LPM0_bits + GIE);     // Enter LPM4, Enable interrupts
    
        // Temperature in Celsius. See the Device Descriptor Table section in the
        // System Resets, Interrupts, and Operating Modes, System Control Module
        // chapter in the device user's guide for background information on the
        // used formula.
        temperatureDegC = (float)(((long)results[1] - CALADC12_15V_30C) * (85 - 30)) /
                (CALADC12_15V_85C - CALADC12_15V_30C) + 30.0f;
    
        // Temperature in Fahrenheit Tf = (9/5)*Tc + 32
        temperatureDegF = temperatureDegC * 9.0f / 5.0f + 32.0f;
        __delay_cycles(10000);
        __no_operation();                       // For debugger    
      }
    }
    
    #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
    #pragma vector=ADC12_VECTOR
    __interrupt void ADC12ISR (void)
    #elif defined(__GNUC__)
    void __attribute__ ((interrupt(ADC12_VECTOR))) ADC12ISR (void)
    #else
    #error Compiler not supported!
    #endif
    {
      switch(__even_in_range(ADC12IV,34))
      {
      case  0: break;                           // Vector  0:  No interrupt
      case  2: break;                           // Vector  2:  ADC overflow
      case  4: break;                           // Vector  4:  ADC timing overflow
      case  6: break;                           // Vector  6:  ADC12IFG0
      case  8:
          results[0] = ADC12MEM0;                 // Move results, IFG is cleared
          results[1] = ADC12MEM1;                 // Move results, IFG is cleared
        //  results[2] = ADC12MEM2;                 // Move results, IFG is cleared
        //  results[3] = ADC12MEM3;                 // Move results, IFG is cleared
          __bic_SR_register_on_exit(LPM0_bits);   // Exit active CPU, SET BREAKPOINT HERE
          break;                           // Vector  8:  ADC12IFG1
      case 10: break;                           // Vector 10:  ADC12IFG2
      case 12: break;                                 // Vector 12:  ADC12IFG3
    
      case 14: break;                           // Vector 14:  ADC12IFG4
      case 16: break;                           // Vector 16:  ADC12IFG5
      case 18: break;                           // Vector 18:  ADC12IFG6
      case 20: break;                           // Vector 20:  ADC12IFG7
      case 22: break;                           // Vector 22:  ADC12IFG8
      case 24: break;                           // Vector 24:  ADC12IFG9
      case 26: break;                           // Vector 26:  ADC12IFG10
      case 28: break;                           // Vector 28:  ADC12IFG11
      case 30: break;                           // Vector 30:  ADC12IFG12
      case 32: break;                           // Vector 32:  ADC12IFG13
      case 34: break;                           // Vector 34:  ADC12IFG14
      default: break; 
      }
    }
    
    

  • Hi Anthony

    I think we have find the root cause for this issue:

    In the user's guide page740  when ADC used in Sequence-of-Channels Mode  “The ADC12SC must be cleared by software after each sequence to trigger another sequence.” In normally cases, the ADC12SC will be reset automatically, but for some devices it can't. So we recommend to clear this bit by software. You can test it just set a bread point in the ADC conversion ISR in the bad part to see if the   ADC12SC reset automatically to verify it. 

    Best regards

    Gary

  • Hi Gary,

    It looks like our example code doesn't include your recommendation. Can you verify this modified example code so Anthony can test on his boards? I added line 155. Line 156 is there for test.

    msp430x54xA_adc12_09_modified.c
    /* --COPYRIGHT--,BSD_EX
     * Copyright (c) 2012, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
     *******************************************************************************
     * 
     *                       MSP430 CODE EXAMPLE DISCLAIMER
     *
     * MSP430 code examples are self-contained low-level programs that typically
     * demonstrate a single peripheral function or device feature in a highly
     * concise manner. For this the code may rely on the device's power-on default
     * register values and settings such as the clock configuration and care must
     * be taken when combining code from several examples to avoid potential side
     * effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware
     * for an API functional library-approach to peripheral configuration.
     *
     * --/COPYRIGHT--*/
    //******************************************************************************
    //  MSP430F543xA Demo - ADC12_A, Sequence of Conversions (non-repeated)
    //
    //  Description: This example shows how to perform A/D conversions on a sequence
    //  of channels. A single sequence of conversions is performed - one conversion
    //  each on channels A0, A1, A2, and A3. Each conversion uses AVcc and AVss for
    //  the references. The conversion results are stored in ADC12MEM0, ADC12MEM1,
    //  ADC12MEM2, and ADC12MEM3 respectively and are moved to 'results[]' upon
    //  completion of the sequence. Test by applying voltages to pins A0, A1, A2,
    //  and A3, then setting and running to a break point at the "_BIC..."
    //  instruction in the ISR. To view the conversion results, open a watch window
    //  in debugger and view 'results' or view ADC12MEM0, ADC12MEM1, ADC12MEM2, and
    //  ADC12MEM3 in an ADC12 SFR window.
    //  This can run even in LPM4 mode as ADC has its own clock
    //  Note that a sequence has no restrictions on which channels are converted.
    //  For example, a valid sequence could be A0, A3, A2, A4, A2, A1, A0, and A7.
    //  See the 5xx User's Guide for instructions on using the ADC12.
    //
    //                MSP430F5438A
    //             -----------------
    //         /|\|                 |
    //          | |                 |
    //          --|RST              |
    //            |                 |
    //    Vin0 -->|P6.0/A0          |
    //    Vin1 -->|P6.1/A1          |
    //    Vin2 -->|P6.2/A2          |
    //    Vin3 -->|P6.3/A3          |
    //            |                 |
    //
    //   M Morales
    //   Texas Instruments Inc.
    //   June 2009
    //   Built with CCE Version: 3.2.2 and IAR Embedded Workbench Version: 4.11B
    //******************************************************************************
    
    #include <msp430.h>
    
    
    #define CALADC12_15V_30C  *((unsigned int *)0x1A1A)   // Temperature Sensor Calibration-30 C
                                                          //See device datasheet for TLV table memory mapping
    #define CALADC12_15V_85C  *((unsigned int *)0x1A1C)   // Temperature Sensor Calibration-85 C
    
    unsigned int temp;
    volatile float temperatureDegC;
    volatile float temperatureDegF;
    
    volatile unsigned int results[4];           // Needs to be global in this example
                                                // Otherwise, the compiler removes it
                                                // because it is not used for anything.
    
    int main(void)
    {
      WDTCTL = WDTPW+WDTHOLD;                   // Stop watchdog timer
      
      P6SEL = 0x80;                             // Enable A/D channel 3 inputs
    
      /* Initialize the shared reference module */
      REFCTL0 |= REFMSTR + REFVSEL_0 + REFON;    // Enable internal 2.5V reference
      /* Initialize ADC12_A */ 
      ADC12CTL0 = ADC12ON+ADC12MSC+ADC12SHT0_8; // Turn on ADC12, set sampling time
      ADC12CTL1 = ADC12SHP+ADC12CONSEQ_1;       // Use sampling timer, single sequence
      ADC12MCTL0 = ADC12SREF_1+ADC12INCH_7;                 // ref+=AVcc, channel = A0
      ADC12MCTL1 = ADC12SREF_1+ADC12INCH_10+ADC12EOS;                 // ref+=AVcc, channel = A1
     // ADC12MCTL2 = ADC12INCH_2;                 // ref+=AVcc, channel = A2
    //  ADC12MCTL3 = ADC12INCH_3;        // ref+=AVcc, channel = A3, end seq.
      ADC12IE = ADC12IE1;                           // Enable ADC12IFG.3
      ADC12CTL0 |= ADC12ENC;                    // Enable conversions
      P10DIR |= BIT4; //AJC
      P10OUT &= ~BIT4; //AJC start low
      while(1)
      {
        ADC12CTL0 |= ADC12SC;                   // Start convn - software trigger
        
        __bis_SR_register(LPM0_bits + GIE);     // Enter LPM4, Enable interrupts
    
        // Temperature in Celsius. See the Device Descriptor Table section in the
        // System Resets, Interrupts, and Operating Modes, System Control Module
        // chapter in the device user's guide for background information on the
        // used formula.
        temperatureDegC = (float)(((long)results[1] - CALADC12_15V_30C) * (85 - 30)) /
                (CALADC12_15V_85C - CALADC12_15V_30C) + 30.0f;
    
        // Temperature in Fahrenheit Tf = (9/5)*Tc + 32
        temperatureDegF = temperatureDegC * 9.0f / 5.0f + 32.0f;
        __delay_cycles(10000);
        __no_operation();                       // For debugger    
      }
    }
    
    #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
    #pragma vector=ADC12_VECTOR
    __interrupt void ADC12ISR (void)
    #elif defined(__GNUC__)
    void __attribute__ ((interrupt(ADC12_VECTOR))) ADC12ISR (void)
    #else
    #error Compiler not supported!
    #endif
    {
      switch(__even_in_range(ADC12IV,34))
      {
      case  0: break;                           // Vector  0:  No interrupt
      case  2: break;                           // Vector  2:  ADC overflow
      case  4: break;                           // Vector  4:  ADC timing overflow
      case  6: break;                           // Vector  6:  ADC12IFG0
      case  8:
        results[0] = ADC12MEM0;                 // Move results, IFG is cleared
        results[1] = ADC12MEM1;                 // Move results, IFG is cleared
        //  results[2] = ADC12MEM2;                 // Move results, IFG is cleared
        //  results[3] = ADC12MEM3;                 // Move results, IFG is cleared
        ADC12CTL0 &= ~ADC12SC;                   // Clear start conversion bit
        P10OUT ^= BIT4; //AJC Toggle pin
        __bic_SR_register_on_exit(LPM0_bits);   // Exit active CPU, SET BREAKPOINT HERE
        break;                           // Vector  8:  ADC12IFG1
      case 10: break;                           // Vector 10:  ADC12IFG2
      case 12: break;                                 // Vector 12:  ADC12IFG3
    
      case 14: break;                           // Vector 14:  ADC12IFG4
      case 16: break;                           // Vector 16:  ADC12IFG5
      case 18: break;                           // Vector 18:  ADC12IFG6
      case 20: break;                           // Vector 20:  ADC12IFG7
      case 22: break;                           // Vector 22:  ADC12IFG8
      case 24: break;                           // Vector 24:  ADC12IFG9
      case 26: break;                           // Vector 26:  ADC12IFG10
      case 28: break;                           // Vector 28:  ADC12IFG11
      case 30: break;                           // Vector 30:  ADC12IFG12
      case 32: break;                           // Vector 32:  ADC12IFG13
      case 34: break;                           // Vector 34:  ADC12IFG14
      default: break; 
      }
    }
    
    

  • Your change is correct.

**Attention** This is a public forum