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.

Problem facing during ADC12 interface

Other Parts Discussed in Thread: MSP430FG4618

Hi forum members, i am actually facing some problem regarding ADC12 of my MSP430FG4618/F2013 experimenter's board. When i am trying to run the TI code" MSP430xG461x Demo - ADC12, Using the Internal Reference" i found that the "watch window" show me the garbage value of 0x000140 in my code composer studio(version 4.2). In the TI code the internal reference voltage is 2.5v and i choose the input voltage 2.5v DC, so the output should be 0xFF instead of 0x000140. In my settings i give +2.5v DC to channel A0 which is P6.0 and ground the board in the DVss1 which is internally grounded with JTAG2 pin NO.5. I just give the TI code and the image of the setup below.

//******************************************************************************
//   MSP430xG461x Demo - ADC12, Using the Internal Reference
//
//   This example shows how to use the internal reference of the ADC12.
//   It uses the internal 2.5V reference and performs a single conversion
//   on channel A0. The conversion results are stored in ADC12MEM0. Test by
//   applying a voltage to channel A0, then setting and running to a breakpoint
//   at "__no_operation()".
//   To view the conversion results, open a register window in Debugger and
//   view the contents of ADC12MEM0.
//   ACLK = 32kHz, MCLK = SMCLK = default DCO 1048576Hz, ADC12CLK = ADC12OSC
//
//
//                MSP430xG461x
//              ---------------
//             |            XIN|-
//             |               | 32kHz
//      Vin -->|P6.0/A0    XOUT|-
//             |               |
//
//
//   A. Dannenberg/ M. Mitchell
//   Texas Instruments Inc.
//   October 2006
//   Built with CCE Version: 3.2.0 and IAR Embedded Workbench Version: 3.41A
//******************************************************************************
#include "msp430xG46x.h"

volatile unsigned int i;

void main(void)
{
  WDTCTL = WDTPW + WDTHOLD;                 // Stop watchdog
  P6SEL |= 0x01;                            // Enable A/D channel A0
  ADC12CTL0 = REFON + REF2_5V + ADC12ON + SHT0_2;
                                            // turn on 2.5V ref, set samp time
  ADC12CTL1 = SHP;                          // Use sampling timer
  ADC12MCTL0 = SREF_1;                      // Vr+=Vref+

  for (i = 0x3600; i; i--);                 // Delay for needed ref start-up.
                                            // See datasheet for details.
  ADC12CTL0 |= ENC;                         // Enable conversions


  while (1)
  {
    ADC12CTL0 |= ADC12SC;                   // Start conversions
    while (!(ADC12IFG & 0x0001));           // Conversion done?
    ADC12MEM0;                              // Access result
    __no_operation();                       // SET BREAKPOINT HERE
  }
}
===================================================

 

And the CCS window is given below

So this is the all about. If anybody have the solution please give me the reply.

Best Regards

Souvik

  • What you see in your Watch window is the pointer value of the ADC12MEM0, as it's a pointer to the actual register. If you want to watch the value in that register you can click that + in front of the ADC12MEM0 or you add the following watch expression:

    *((unsigned int*)ADC12MEM0)

    A better tool to check  register values is the register view. I can't see it in your setup, so go to Window -> Show View -> Register

    Then you have a list of all the registers ordered by their module.

  • Thank you for your reply, i have done whatever you have told me but when i just want to know the value of the register it shows me "Unable to read" and when i click that + in front of the ADC12MEM0 it shows me "Cannot load from non primitive location " and when i add the watch expression ((unsigned int*)ADC12MEM0) it shows me "execution state prevented action"..... I just give you the screenshot of the window below.

    So i just do whatever you told but i can't show the output. If you have any other solution please reply and if you know how to show the ADC value on board please give me the procedure.

     

  • You have to halt the execution of the program to be able to read the actual status of your MSP and it's registers/memory, so just click the "Pause" button in your Debug view and the values should be updated to the current values.

    Or you can set a breakpoint at a certain location if you want to look what are the values at that point of execution, just double click on the gray border on the left side of your line numbers and a blue dot (Breakpoint) will appear, now the MSP is halted automatically if it reaches that line of code and the display of the registers will be updated. If you want to disable the breakpoint, double click it again and it should disappear.

  • Many many Thanks Bernhard for your reply. Yes it works finally. Gr8 reply. So again i will say thank you.

**Attention** This is a public forum