• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Microcontrollers » MSP430™ Microcontrollers » MSP430 Ultra-Low Power 16-bit Microcontroller Forum » ADC12 in MSP430f2618
Share
MSP430™ Microcontrollers
  • Forum
  • Announcements
  • E2E Wiki
Options
  • Subscribe via RSS
MSP430 Resources
  • MSP430 Product Folder
  • MSP-EXP430G2 - MSP430 LaunchPad Value Line Development kit
  • MSP430 Getting Started Guide
  • MSP430 Microcontroller Projects
  • More Resources >
  • ADC12 in MSP430f2618

    ADC12 in MSP430f2618

    This question is not answered
    shivraj dagadi
    Posted by shivraj dagadi
    on Jun 06 2012 06:58 AM
    Intellectual350 points

    Hi! all

    am currently working with msp430+ cc2520. I configured ADC12 and using it. I have two routiens to read ADC channel 11 and ADC channel 12 respectively. While reading ADC, channel 11 is giving me ADC count as 2021. This is ok but the channel 12 is also giving the same value. What can be the problem ? please reply ...here the code which i am using to read adc

    /*ADC channel 11*/

    uint16 HalMyAdc11Read ()
    {
    /* Setup sampling */
    ADC12CTL0 = ADC12ON + SHT0_7; //192 cycles
    HAL_ADC_11_MEM_CONTROL = SREF_0 | HAL_ADC_11_CHANNEL;

    /* Disable conversions */
    HAL_ADC_DISABLE_12()
    /* Use sampling timer */
    ADC12CTL1 = HAL_ADC_11_CONV_STARTADDR | SHP;
    /* Enable conversions */
    HAL_ADC_ENABLE_12();
    /* Start Conversion */
    ADC12CTL0 |= ADC12SC;
    /* Wait for conversion to be done */
    while (!(ADC12IFG & HAL_ADC_11_CH_BV));

    /* Get Result */
    return (HAL_ADC_11_RESULT);
    }

    Here is the code for reading ADC 12 channel

    /*ADC channel number 12*/

    uint16 HalMyAdc12Read ()
    {
    /* Setup sampling */
    ADC12CTL0 = ADC12ON + SHT0_7 ; //192 cycles
    HAL_ADC_12_MEM_CONTROL = SREF_0 | HAL_ADC_12_CHANNEL;

    /* Disable conversions */
    HAL_ADC_DISABLE_12()
    /* Use sampling timer */
    ADC12CTL1 = HAL_ADC_12_CONV_STARTADDR | SHP;
    /* Enable conversions */
    HAL_ADC_ENABLE_12();
    /* Start Conversion */
    ADC12CTL0 |= ADC12SC;
    /* Wait for conversion to be done */
    while (!(ADC12IFG & HAL_ADC_12_CH_BV));

    /* Get Result */
    return (HAL_ADC_12_RESULT);
    }

    Channel 12 shold give a count around 0 but it is not the case here

    Please reply

    Thanking you

    shivraj

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • Jens-Michael Gross
      Posted by Jens-Michael Gross
      on Jun 08 2012 07:10 AM
      Guru140435 points

      I wonder why you use all this HAL stuff when it doesn't do anything different than setting the ADC12 registers 1:1.
      It jsut adds a leayer of obfuscation to the code and brings no benefit. Also, you partly configure the ADC12 directly instead of using HAL functions. If teh HAL serves any purpose besides adding possible confusion, not using the HAL for these operations (like setting ADC12SC) may interfere with it and lead to completely unpredictable results.

      Anyway, you configure SHT0_7, but use HAL_ADC_11_MEM_CONTROL for sampling channel 11 (note that ADC12MEM11, and any other ADC12MEM register) can be used to sample any ADC input channel), and for setting the SHT value for ADC12MEM8..15 you'll have to define the SHT with SHT1_x.

      _____________________________________
      Before posting bug reports or ask for help, do at least quick scan over this article. It applies to any kind of problem reporting. On any forum. And/or look here.
      If you cannot discuss your problem in the public, feel free to start a private conversation: click on my name and then 'start conversation'. But please do so only if you really cannot do it in a public thread, as I usually read all threads. And I prefer to answer where others can profit from it (or contribute to it) too.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • shivraj dagadi
      Posted by shivraj dagadi
      on Jun 11 2012 02:22 AM
      Intellectual350 points

      Thanks! Michael 

      I Checked with SHT using SHT1_7 instead of SHT0_7 but this time also its giving me the same results.

      Whats The problem with this ? 

      Please reply 

      Thanks 

      Shivraj

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Jens-Michael Gross
      Posted by Jens-Michael Gross
      on Jun 11 2012 11:20 AM
      Guru140435 points

      Lookign at the schematics of the ADC12 in the users guide, channel 11 is VCC/2 and channel 12 is floating. It's well possible that a floating pin gives a similar result as VCC/2. Or as the teh last chanel used. I don' tknow.

      And since I don't know what your HAL functions really do, I cannot say what else might be wrong.

      _____________________________________
      Before posting bug reports or ask for help, do at least quick scan over this article. It applies to any kind of problem reporting. On any forum. And/or look here.
      If you cannot discuss your problem in the public, feel free to start a private conversation: click on my name and then 'start conversation'. But please do so only if you really cannot do it in a public thread, as I usually read all threads. And I prefer to answer where others can profit from it (or contribute to it) too.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    TI E2E™ Community
    • Support Forums
    • Blogs
    • Videos
    • Groups
    • Site Support & Feedback
    • Settings
    TI E2E™ Community Groups
    • TI University Program
    • Make the Switch
    • Microcontroller Projects
    • Motor Drive & Control
    Other Communities
    • Deyisupport
    • Designsomething.org
    • beagleboard.org
    • TI on Element 14
    • TI on TechXchangeSM
    Other Technical & Support Resources
    • WEBENCH® Design Center
    • Product Information Centers
    • Technical Documents
    • TI Design Network
    • TI Technical Articles
    • TI Training

    All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

    Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

    Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
    TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

    TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
    embedded processors, along with software, tools and the industry’s largest sales/support staff.

    © Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
    Trademarks | Privacy Policy | Terms of Use