• 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 » Low Power RF & Wireless Connectivity » Low Power RF Proprietary Software & SimpliciTI Forum » Help needed in ADC sampling using msp430 ez430-rf2500
Share
Low Power RF & Wireless Connectivity
  • Forums
  • Announcements
  • Files
  • E2E Wiki
Options
  • Subscribe via RSS

Forums

Help needed in ADC sampling using msp430 ez430-rf2500

This question is answered
Than Han Siang
Posted by Than Han Siang
on Apr 02 2012 19:37 PM
Prodigy130 points

Hi guys. I'm required to transmit the data from the function generator by connecting the output of the function generator directly to the MSP430 eZ430-RF2500 board and transmit the data to PC. I couldn't get the data. Can anyone help me on it ? Below are my code. Can anyone tell me where i've write it wrongly ? Thanks...

    /* Time to measure */

    if (sSelfMeasureSem) {

      volatile long temp;

      int degC, TransmittedData,value;

      int results[2];

#ifdef APP_AUTO_ACK

      uint8_t      noAck;

      smplStatus_t rc;

#endif

 

      /* Get temperature */

      ADC10CTL1 = INCH_10 + ADC10DIV_4;       // Temp Sensor ADC10CLK/5

      ADC10CTL0 = SREF_1 + ADC10SHT_3 + REFON + ADC10ON + ADC10IE + ADC10SR;

      /* Allow ref voltage to settle for at least 30us (30us * 8MHz = 240 cycles)

       * See SLAS504D for settling time spec

       */

      __delay_cycles(240);

      ADC10CTL0 |= ENC + ADC10SC;             // Sampling and conversion start

      __bis_SR_register(CPUOFF + GIE);        // LPM0 with interrupts enabled

      results[0] = ADC10MEM;                  // Retrieve result

      ADC10CTL0 &= ~ENC;

     

      /* Get TransmittedData */

      ADC10AE0 |= 0x02;

      ADC10CTL1 = INCH_4 + ADC10DIV_4;       // waveform Sensor ADC10CLK/5

      ADC10CTL0 = SREF_1 + ADC10SHT_2 + REFON + ADC10ON + ADC10IE + REF2_5V;

      __delay_cycles(240);

      ADC10CTL0 |= ENC + ADC10SC;             // Sampling and conversion start

      __bis_SR_register(CPUOFF + GIE);        // LPM0 with interrupts enabled

      results[1] = ADC10MEM;                  // Retrieve result

      ADC10CTL0 &= ~ENC;

 

         /* Stop and turn off ADC */

      ADC10CTL0 &= ~ENC;

      ADC10CTL0 &= ~(REFON + ADC10ON);

 

      /* oC = ((A10/1024)*1500mV)-986mV)*1/3.55mV = A10*423/1024 - 278

       * the temperature is transmitted as an integer where 32.1 = 321

       * hence 4230 instead of 423

       */

      temp = results[0];

      degC = ((temp - 673) * 4230) / 1024;

      if( (*tempOffset) != 0xFFFF )

      {

        degC += (*tempOffset);

      }

 

      /* message format,  UB = upper Byte, LB = lower Byte

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

      |degC LB | degC UB |  volt LB |

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

         0         1          2

      */

      TransmittedData = results[1];

      value = TransmittedData*0.024;

      msg[0] = degC&0xFF;

      msg[1] = (degC>>8)&0xFF;

      msg[2] = value;

 

    

Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Leo Hendrawan
    Posted by Leo Hendrawan
    on Apr 03 2012 06:36 AM
    Mastermind27575 points

    Hi,

    the highlighted code part seems to be ok (i haven't really tested it, just a quick look), but one of the most common problem if the ADC result is not correct is the sampling time. Could you test it with bigger sampling time (ADC10SHT_3 or ADC10SHT_4)? Please refer to the MSP430x2xx Family User's Guide, chapter 22.2.5.1 "Sample Timing Considerations".

    Hope this helps.

    -Leo-

    Regards,

    Leo Hendrawan

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Than Han Siang
    Posted by Than Han Siang
    on Apr 03 2012 07:16 AM
    Prodigy130 points

    Hi Leo,

    Okay. I will test it with bigger sampling time. By using the code above, I have supplied the DC supply to the board to compare the transmitted result is the same with the supply or not. The result seems to be okay. But it will stuck at 2.4V and couldn't be increase any more even my supply is 3V but it only display 2.4V in Putty. After that I tried it with square wave, I couldn't get any result from it. Do you know what's the problem ?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Leo Hendrawan
    Posted by Leo Hendrawan
    on Apr 03 2012 07:28 AM
    Verified Answer
    Verified by Leo Hendrawan
    Mastermind27575 points

    Hi,

    I think this is due to the fact that you are using the internal 2.5V reference voltage. Referring to the MSP430x2xx Family User's Guide, chapter 22.2.1 "10-Bit ADC Core", you can find the following statement:

    The digital output (N ADC ) is full scale (03FFh) when the input signal is equal to or higher than V R+ , and zero when the input signal is equal to or lower than V R- .

    VR+ in your code is basically the internal 2.5V input, then the maximum input is limited to this value. In this case you can try to feed an external reference output voltage to achieve conversion for input greater than 2.5V.

    I hope this helps.

    Regards,

    Leo Hendrawan

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Than Han Siang
    Posted by Than Han Siang
    on Apr 03 2012 07:33 AM
    Prodigy130 points

    Hi,

    Thanks a lot leo. I'll test it tomorrow morning as I don't have the instrument in my house. Hopefully it works. If got any problem can I ask for your help again ? 

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Leo Hendrawan
    Posted by Leo Hendrawan
    on Apr 03 2012 07:41 AM
    Mastermind27575 points

    Hi,

    sure, but i think you post the question on the wrong forum. Since your question is more related to the MSP430, you should post the question to the MSP430 forum instead:

    http://e2e.ti.com/support/microcontrollers/msp43016-bit_ultra-low_power_mcus/default.aspx

    The forum is very active, and there are lot of helping hands there even from people outside TI.

    -Leo-

    Regards,

    Leo Hendrawan

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Than Han Siang
    Posted by Than Han Siang
    on Apr 03 2012 07:44 AM
    Prodigy130 points

    Hi,

    Oh. Okay. I'll post it there. Sorry. I'm new here. Anyway, thanks a lot. =)

    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