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.

MSP430F6638IPZR

Other Parts Discussed in Thread: MSP430F6638

I am using this chip MSP430F6638IPZR. I have a board on which this chip can be mounted and programmed. There is also a MSP430 USB-Debug-Interface MSP-FET430UIF. I know that the maximum software configurable supply voltage that this USB-Debug-Interface can handle is between 1.8 V to 3.6 V at 100 mA. I am trying to work with a sample program from the Texas instruments folder list. The code is as follows:

//******************************************************************************

//  MSP430F66x Demo - ADC12, Using the Internal Reference

//

//  Description: This example shows how to use the internal reference of REF

//  module using the ADC12 control registers.

//  The ADC12 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 break point

//  at the "__no_operation()" instruction. To view the conversion results,

//  open an ADC12 register window in debugger and view the contents of ADC12MEM0

//                MSP430F66x

//             -----------------

//         /|\|                 |

//          | |                 |

//          --|RST              |

//            |                 |

//     Vin -->|P6.0/CB0/A0      |

//            |                 |

//

//   Priya Thanigai

//   Texas Instruments Inc.

//   Nov 2009

//   Built with IAR Embedded Workbench Version: 4.20 & Code Composer Studio V4.0

//******************************************************************************

#include <msp430f6638.h>

 

void main(void)

{

  volatile unsigned int i;

  WDTCTL = WDTPW+WDTHOLD;                   // Stop watchdog timer

  P6SEL |= 0x01;                            // Enable A/D channel A0

  REFCTL0 &= ~REFMSTR;                      // Reset REFMSTR to hand over control to

                                            // ADC12_A ref control registers

  ADC12CTL0 = ADC12ON+ADC12SHT02+ADC12REFON+ADC12REF2_5V;

                                            // Turn on ADC12, Sampling time

                                            // On Reference Generator and set to

                                            // 2.5V

  ADC12CTL1 = ADC12SHP;                     // Use sampling timer

  ADC12MCTL0 = ADC12SREF_1;                 // Vr+=Vref+ and Vr-=AVss

 

  for ( i=0; i<0x30; i++);                  // Delay for reference start-up

 

  ADC12CTL0 |= ADC12ENC;                    // Enable conversions

 

  while (1)

  {

    ADC12CTL0 |= ADC12SC;                   // Start conversion

    while (!(ADC12IFG & BIT0));

    __no_operation();                       // SET BREAKPOINT HERE

 

  }

}

 

The above code says that the ADC12 uses the internal 2.5 V reference and performs a single conversion on channel A0 and we can test it by applying a voltage to channel A0. Now my doubt is, what is the voltage range that can be applied to channel A0???  I mean what is the range of voltage that this chip can perform Analog to Digital Conversion on ??????

Thanks in advance :)

  • Hello Lakshmi,

    Welcome to the forum! 

    It sounds to me like you are asking how can you possibly use the ADC to measure real world voltages when you are limited to a Vref of 2.5 volts!

    I will give you the short version.  I'm sure others will provide a longer one.  Basically with a Vref of 2.5V, the ADC can only measure up 2.5V.  Anything higher than that is registered as the same 2.5V.  if you exceed the maximum input voltage of the pin, you will destroy that input.

    The way to measure real world voltages is to use a voltage divider and/or opamp to either increase or decrease that voltage so it falls within the 0 to 2.5V range.  Feel free to search the TI website for documents and tutorials on how ADCs work.

    Thanks,

  • Thank you so much for your help :)  But i have another simple doubt!!

    Now i am connecting this BOARD ( with MSP430F6638IPZR chip mounted on it ) to the PC via this MSP430 USB-DEBUG-Interface (MSP-FET430UIF)......I know that the target voltage that can be given to this USB should be between 2.2 V to 3.6 V.....But my doubt is does this target voltage that i set to this USB become the supply voltage to the BOARD ????

    Thanks in Advance :)

  • Lakshmi Polusani said:
    I know that the target voltage that can be given to this USB should be between 2.2 V to 3.6 V.....But my doubt is does this target voltage that i set to this USB become the supply voltage to the BOARD ?

    The FET debugger operates from the PC's 5V USB supply.

    Internally, it has a programmable voltage regulator to supply VCC to the target board.

    You can set this target output voltage level in the debugger options. I use IAR, and this is what the screen looks like:

  • Thanks for answering my question :)  i have another doubt regarding the same code....the code says that the conversion results are stored in ADC12MEM0, but when i look into the memory window and type this "ADC12MEM0" then it displays (  Hex 16- Bit TI Style Hex )

    0x000720   0000 0000 0000 0000 0000 0000 0000

    And when I look into the registers, I see this:

    Name                       Value

    ADC12MEM0          0x0000

    Now my doubt is where should I look ( in the memory or in the registers) for the conversion Result ? And what is the value of the Digital output voltage in the above case?? 

    Thanks in advance.. :) 

  • Lakshmi Polusani said:
    my doubt is does this target voltage that i set to this USB become the supply voltage to the BOARD ????

    Brian already gave first half of the answer. However, it depends on which pin of the 14 pin JTAG header you connect to the boards supply voltage. In one case, the FET wil source the board, while in the other case, teh FET will sense the boards supply voltage and auto-adjust its output signals to this voltage, independently of the setting in the PC software.

    Lakshmi Polusani said:
    Now my doubt is where should I look ( in the memory or in the registers) for the conversion Result ?

    All hardware registers are memory-mapped. So it make sno difference whether you look at ADC12MEM0 in register view, or at the first two bytes of the memory view at ADC12MEM0 location. However, register view is better since the debugge rthen knows that it is a register and can change even without code execution, and it will also only read this register and not a whole memory block (possible other registers with read-sensitive content).

    The initial value of ADC12MEM0 is likely 0x0000, but it will change after the first successfull conversion. It doesn't automatically change all the time. Only when the ADC is instructed to perform a conversion based on ADC12MCTL0 register.

    Lakshmi Polusani said:
    And what is the value of the Digital output voltage in the above case?

    ??? The ADC takes an anlog voltage form its input and converts it into a number. Th enumber depends on teh input coltage and the reference voltage used fo rconversion. There is no digital output voltage.
    However, if the result of an actual conversion is x (0x000 in your case), then the rough input voltage (since there are offset and gain calibraiton values to consider) is x*Vref/4095.
    Where Vref is the chosen reference voltage, either VCC or 2.5V, 2V or 1.5V, depending on ADC12MCTLx and REF module configuration. And 4095 applies to 12 bit mode.

**Attention** This is a public forum