• 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 » ADC12MEM0 to Putty/Hyperterminal
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 >
  • ADC12MEM0 to Putty/Hyperterminal

    ADC12MEM0 to Putty/Hyperterminal

    This question is not answered
    Eugene Smith
    Posted by Eugene Smith
    on Apr 07 2012 19:27 PM
    Prodigy10 points

    Hey guys,


    My issue is this. I am trying to input an audio signal from the stylus of a record player into the MSP430. I want to convert this signal to digital using the ADC12, then I want to read these values and send them out serially to Hyperterminal. My problem is I want to send every conversion out serially without missing one. My plan right now is to start conversions in my main routine then every time a conversion is completed I want to jump to an ISR and store the incoming conversion into a buffer. While my main routine continues to send out the values from my buffer serially to a Hyperterminal or Putty application. However, I am not sure how to setup the buffer. In addition, I want to convert the values coming into the Hyperterminal into hex values rather than the random characters that appear. Below is the code I have so far, and I know that it does not do what I need.

    # include <msp430xG46x.h>

    volatile unsigned int ADCSample;

    void main(void)
    {
    WDTCTL = WDTPW+WDTHOLD; // Stop watchdog

    // Initialization of ADC12//

    P6SEL |= 0x01; // Enable A/D channel A0
    ADC12CTL0 &= ~ENC; // Disable Conversions
    ADC12CTL0 = ADC12ON + SHT0_2 + REFON + REF2_5V + MSC; // turn on ADC12, set samp time
    ADC12CTL1 = SHP+CONSEQ_2; // Use sampling timer
    ADC12MCTL0 = SREF_5+INCH_0; // Vr+=VeREF+ (external)
    ADC12IE = 0x02; //ADC12IFG.1
    ADC12CTL0 |= ENC; // Enable conversions
    __enable_interrupt(); // Enable interrupts

    // Initialization of Rs-232//

    FLL_CTL0 |= XCAP14PF; // Configure load caps
    do
    {
    IFG1 &= ~OFIFG; // Clear OSCFault flag
    _delay_cycles(50000); // Time for flag to set
    }
    while ((IFG1 & OFIFG)); // OSCFault flag still set?

    P2SEL |= 0x30; // P2.4,5 = USCI_A0 RXD/TXD
    UCA0CTL1 |= UCSSEL_1; // CLK = ACLK
    UCA0BR0 = 0x03; // 32k/9600 - 13.65
    UCA0BR1 = 0x00; //
    UCA0MCTL = 0x06; // Modulation
    UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
    IE2 |= UCA0TXIE + UCA0RXIE; // enable RXD and TXD interrupt;

    //Serial Loop

    while (1)
    {
    ADC12CTL0 |= ADC12SC; // Start conversions
    while (!(ADC12IFG & 0x0001)); // Conversion done?
    __bis_SR_register(LPM0_bits + GIE);
    UCA0TXBUF = ADCSample; // send lower part
    __no_operation();
    _delay_cycles(1000); // wait for first transmit
    UCA0TXBUF = ADCSample >> 8; // send upper part
    }
    }

    //ADC12 ISR

    #pragma vector=ADC12_VECTOR
    __interrupt void ADC12ISR (void)
    {
    ADC12CTL0 &= ~ENC; //Disable Conversions
    ADCSample = ADC12MEM0; //Move ADC value to Buffer
    ADC12CTL0 |= ENC; //Enable Conversions
    ADC12CTL0 |= ADC12SC; //Start Conversions
    __no_operation(); // SET BREAKPOINT HERE
    __bic_SR_register_on_exit(LPM0_bits); // Exit LPM0
    }

    ADC10 hyperterminal
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • Roberto Romano
      Posted by Roberto Romano
      on Apr 08 2012 06:17 AM
      Mastermind6840 points

      Eugene Smith
      I have a MAJOR project due in less than a week. I understand this forum is about learning and not for providing code verbatim, but having said that I am in a jam. I am willing to PAY 100 USD to the person that can get this code running properly via paypal.

       Hi Eugene, strange behaviour, your code and problem is very close to the one of Preston, see here
      :

      http://e2e.ti.com/support/microcontrollers/msp43016-bit_ultra-low_power_mcus/f/166/t/181042.aspx

       If this can solve your problem I am ready for payment but I cannot run code by paypal too ;)

       Regards

       Roberto


       Please login & click    Verify Answer    if this post answered your question.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Roberto Romano
      Posted by Roberto Romano
      on Apr 08 2012 06:26 AM
      Mastermind6840 points

      Eugene Smith

      My issue is this. I am trying to input an audio signal from the stylus of a record player into the MSP430. I want to convert this signal to digital using the ADC12, then I want to read these values and send them out serially to Hyperterminal.

       No question more but IHMO this is not the good way to do this, a better approach can be to use a CODEC with more dynamic and S/N too.

       The codec is too fast to be processed by MSP but also audio stream can be too fast to be sent serially to a PC, better approach as I was saying can be a codec development connected to a Stellaris LAN series, IE the lm3s9xxx has I2S USB, SD and LAN interfaces, this isolate stylus and preamplifier from pc noise, no fan and no EMF generation so converter can be left close to turntable or record player also as a stand alone SD or pen drive recorder.

       Regards

       Roberto


       Please login & click    Verify Answer    if this post answered your question.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • old_cow_yellow
      Posted by old_cow_yellow
      on Apr 08 2012 10:45 AM
      Guru25715 points

      A byte consists of 8 bits. Is the bit pattern 01000001 a decimal number, hex number, or an ASCII?

      Using c can make life easier for a programmer. But it only helps you to do the tedious dirty work. It does not help you understand the basics. In fact, I think c might even confuse you if you do not understand the basics. A lot of beginners are burned badly by "learning" c. 

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Roberto Romano
      Posted by Roberto Romano
      on Apr 08 2012 15:04 PM
      Mastermind6840 points

      old_cow_yellow
      A lot of beginners are burned badly by "learning" c. 

       Hi OCW, right and not only c related question burn out, suggestion on how to handle a tons of basic missing background questions?

       

       Regards

       Roberto


       Please login & click    Verify Answer    if this post answered your question.

      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 Apr 11 2012 12:29 PM
      Guru140035 points

      A small sanity check:

      Spoken voice has a frequency range of 3.5kHz. So you need to sample with 7kHz. One ADC12 sample is 12 bit. If you transfer it as 2 bytes, you'll have to send 14kB/s, which is a baudrate of 140kBd. Now an old vinyl record has ~14kHz. So when sampling it, you'll get 56kB/s or 560kBd (assuming an uninterrupted data stream, requiring tight hand-crafted code)
      However, most PC COM ports won't go above 115200Bd, some go up 230400Bd.

      CD quality produces ~82kB/s This would require 820kBd transfer rate. For MONO only. STEREO doubles the data.

      And then there is the maximum CPU speed, only 8MHz on the FG46x1 (I don't have the FG46x datasheet at hand).

      Now back to the drawing board...

      What are the exact parameters of the project? Frequency? Required quality (maybe 8 bit per sample are enough). Maybe some sort of compression is required? What are the outlines for the power consumption (and therefore the maximum MSP operating speed?).
      And well, sending binary data to HyperTerm will show only garbage on the screen. But convertign it to readable values first will significantly increase the amount of data. So a dedicated backend software is required on the PC side. Well, take a look at this nice LaunchPad project.

      _____________________________________
      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