• 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 » ADC program for msp430FG4618/F2031 experimenters board from texas instruments
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 >
  • Forums

    ADC program for msp430FG4618/F2031 experimenters board from texas instruments

    This question is answered
    ROHIT JOSHUA
    Posted by ROHIT JOSHUA
    on Apr 18 2012 21:52 PM
    Prodigy50 points

    Hi, 

    My name is Joshua. My friends and I are working on a project on MSP430FG4618. Our project is to basically to interface a very minimal range load cell with the MSP430.We are half way through in finishing the project but we are stuck in a stage where we are not able to frame a ADC program for this chip and also we are not able to find out the input pins on this MSP430FG4618. On going through the user guide manual we got to know that the input pins are in H8 or H9 slots of the MSP chip. So im thinking of connecting a 1v input from a regulator through a resistor pot onto the pin P6.0 and 9th pin of JTAG1 (as it is the GND pin for the negev wire) but this procedure can be done once we get the ADC program.

    I have now explained at what stage my project is in. I would like if someone could help me with an ADC program for my chip and let me know if what ever I am trying to do is right. This is my college project so i need your help very badly. So kindly help me with this project asap. 

    thanking you,

    Joshua

     

    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 Apr 19 2012 13:12 PM
      Guru141810 points

      The pins are simple to find. Analog input voltages for ADC can be applied to the pins with A=-A7  and A12-A15 funcitonality.

      These are the pins B1 (A3), B2 (A4), C2 (A5) C1 (A6), C3 (A7), F1(A12), F2 (A13), E5 (A14), G1 (A15), A4 (A0), D5 (A1) and B4 (A2).

      How do you come to H8 and H9? H9 is P4.0 or USART TX, not an analog input pin. And H8 is NC.
      That is, if we are talking about the same 113pin BGA case (ZQW).
      P6.0, or A0, is on A4 slot. And what do you mean with "9th pin of JTAG1"?

      They accept an analog voltage of 0V to the MSPs (A)VCC, relative to the MSPs (A)VSS. (AVCC and DVCC must be no more than 0.2V from DVCC and DVSS)
      For use with the internal precision references, 1.5V or 2.5V are the maximum.

      About how to use the ADC12, there are several threads in this forum which explain how to use it. And of course teh 4x family users guide will tell you the internals of the ADC12 module.

      Keep in mind that the complete documentation of every MSP chip consists of the device data sheet, the device errata sheet and the device families users guide. All three are available from the individual processors product page. And all three are mandatory.

      _____________________________________
      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.
    • ROHIT JOSHUA
      Posted by ROHIT JOSHUA
      on Apr 23 2012 00:15 AM
      Prodigy50 points

      Thank you for the reply sir. but some of the literature informs us that the P6.0 is used as an analog input pin for adc. and the pin p6.0 was found in the slot H8, thats how we    concluded that pin P6.0 is the input pin. our guide informed us to apply an analog 1k ohm pot to the microcontroller so we applied the positive terminal to the pin P6.0 and the other terminal to the 9th terminal of the JTAG1 as it being denoted as ground pin for the microcontroller.

      Can you please provide the code if possible for the conversion of the analog input to the digital output using adc and display on the lcd.

      awaiting for the reply at utmost urgency.

      thanking you

        

      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 23 2012 12:26 PM
      Guru141810 points

      ROHIT JOSHUA
      some of the literature informs us that the P6.0 is used as an analog input pin for adc.

      Right.

      ROHIT JOSHUA
      and the pin p6.0 was found in the slot H8

      Hmmm, well, from my version of the FG4618 datasheet

      P6.0/A0/OA0I0 95 A4 I/O
      General-purpose digital I/O / analog input a0—12-bit ADC / OA0 input multiplexer on + terminal and − terminal

      So P6.0 is on A4, not H8. H8 appears nowhere on the terminal funcitons map and is probably one of the 13 pins the 113pin BGA has more than the 100pin TQFP case.

      So where did you get this H8 from?

      ROHIT JOSHUA
      the 9th terminal of the JTAG1 as it being denoted as ground pin

      Okay, that's what you meant. However, I'd suggest putting the negative terminal to A3, which is AVSS, to avoid adding any supply noise or GND current to the signal. Also, AVss and DVSS shouldn't be just tied together. Route them separately to the supply (pin9 of the JTAG, if that is your power supply)

      _____________________________________
      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.
    • Srinivasa Suman
      Posted by Srinivasa Suman
      on Apr 24 2012 05:30 AM
      Prodigy20 points

      Jens-Michael Gross

      ROHIT JOSHUA
      some of the literature informs us that the P6.0 is used as an analog input pin for adc.

      Right.

      ROHIT JOSHUA
      and the pin p6.0 was found in the slot H8

      Hmmm, well, from my version of the FG4618 datasheet

      P6.0/A0/OA0I0 95 A4 I/O
      General-purpose digital I/O / analog input a0—12-bit ADC / OA0 input multiplexer on + terminal and − terminal

      So P6.0 is on A4, not H8. H8 appears nowhere on the terminal funcitons map and is probably one of the 13 pins the 113pin BGA has more than the 100pin TQFP case.

      So where did you get this H8 from?

      ROHIT JOSHUA
      the 9th terminal of the JTAG1 as it being denoted as ground pin

      Okay, that's what you meant. However, I'd suggest putting the negative terminal to A3, which is AVSS, to avoid adding any supply noise or GND current to the signal. Also, AVss and DVSS shouldn't be just tied together. Route them separately to the supply (pin9 of the JTAG, if that is your power supply)

      Sir,

      I am trying to connect a sensor to the analog input of the controller to the P6.0 pin i.e., A0 of the analog input on the MSP430FG4618/F2013 Experimenter’s Board.The A4 that you are mentioning is the pin number of P6.0/A0 for the PLASTIC 113-BALL BGA(ZQW) package. On the MSP430FG4618/F2013 Experimenter’s Board it is in PLASTIC 100-PIN TQFP (PZ) package. As mentioned in the evb user's guide the only headers on the experimenters board H1 to H9 and P6.0/A0 (Pin 95)  is connected to the first pin of header H8. There is no A4 mentioned at all.

      I want to know how the analog input can be connected and where to connect the GND on the board. Also I want to know the use of pin7(VREF+) on PZ which is mentioned as 'Output of positive terminal of the reference voltage in the ADC'

       Kindly help me in sorting this issue.Thank you

       

      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 24 2012 08:25 AM
      Guru141810 points

      Srinivasa Suman
      P6.0/A0 (Pin 95)  is connected to the first pin of header H8.

      okay, that explains the confusion. In the original post, there was 'MSP slot H8' mentioned. And the only H8 on an MSP is the H8 pin of the BGA package.

      I had no idea that it meant the header H8 of the experimenters board. And PIN 1 of this H8 header (which apparently has more than one pin then)

      Sorry for the confusion.

      On teh experimenters board, P6.0 is indeed on connector H8.1. However, it is also connected directly to the microphone circuit, as are P6.1 and P6.2. P6.3, P6.4 and P6.7 are connected to the Sallen-key 2nd order OA1 active LPF, and P6.5 (as OA2O) is connected to theaudio output jack. Apparently, P6.6 (A6) is the only input on P6/header H8 that is not directly connected to other circuitry and can be used for extenal analog input.

      Alternatively, P5.0, P10.6 and P10.7 (A13-A15) On H9 can be used. (P5.1 is connected to the LED but with a jumper JP3).

      H9 also bears the connectors for Veref+/-

      _____________________________________
      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.
    • ROHIT JOSHUA
      Posted by ROHIT JOSHUA
      on Apr 24 2012 11:53 AM
      Verified Answer
      Verified by ROHIT JOSHUA
      Prodigy50 points

      thank you once again sir!!!!! can u please help us with the code??? we r struggling with dat!!! only if we get the code we can simulate the pins through IAR software.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Srinivasa Suman
      Posted by Srinivasa Suman
      on Apr 25 2012 00:17 AM
      Prodigy20 points
      msp430xG46x_adc12_01.c

      Thank you sir for clearing my confusion on the availability of A0 on the experimenters board.Also, sir could please tell me the use of pin 7 (Vref+) which is mentioned as 'Output of positive terminal of the reference voltage in the ADC'. I want to know if it can be used as a power source for my sensor signal conditioning circuit.

      ADC code in attached file

      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 25 2012 12:48 PM
      Guru141810 points

      Srinivasa Suman
      could please tell me the use of pin 7 (Vref+)

      When using the internal voltage reference, you can enable this pin. The internal reference voltage is then output to this pin for use with external peripherals. E.g. for an external DAC that is then workign symmetrically to the internal ADC etc. The maximum current is limited, and some storage capacitance is required if this output is enabled.

      It should not be used to power anything, except if the maximum current draw is very, very low. You should use a voltage follower (OpAmp with gain=1) if you want it for driving something.

      About your code: you need to configure ADC12MCTL0. Else it refers to the default setting: A0 input, VCC as reference. It is a good thing to configure it anyway, even with the vlaues which are the default, as it shows your intention. And you don't forget to change it if your intentions change :)
      For the same reason, you should set ADC12CONSEQ_0, ADC12CSTARTADD_0  etc. in ADC12CTL1 and ADC12IE0 instead of 0x01 for ADC12IE.

      Note that the use of ADC12MEM0 is independent of the use of A0 input.

      I don't see any obvious bug in the code. (doesn't mean there is none :) )

      However, A0 is conencted to the microphone hardware on the board, so any voltage you want to feed in there

      _____________________________________
      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.
    • ROHIT JOSHUA
      Posted by ROHIT JOSHUA
      on May 03 2012 10:44 AM
      Prodigy50 points
      Dear Sir,
      I Mallikarjun from RNSIT, working with MSP430FG4618. I am doing work on load cell in which i am using a small program to read the analog voltage. 
      I attached code and the Kit image which tells input and GND.
      here according to the program which was attached, if the input voltage goes above 1.5V the LED4 should glow. But actual problem is if the voltage is increased more than
      1.5V the IC starts to heat up. We are using P6.0 as analog input and other pin as Gnd as shown in the above inserted image. 
      my questions are..

      1) Whether our prediction for P6.0 and Ground is Right or Wrong?
      2) Whether the below inserted program is Right or Wrong?

      Please redirect this to team and help us sir. We are unable to progress with our project. We raised this in Ti helpdesk and not getting proper answer.

      Thank u in advance.
      Regds
      Mallikarjun
      9743207651


      //******************************************************************************
      // MSP430xG461x Demo - ADC12, Sample A0, Set P5.1 if A0 > 0.5*AVcc
      //
      // Description: A single sample is made on A0 with reference to AVcc.
      // Software sets ADC12SC to start sample and conversion - ADC12SC
      // automatically cleared at EOC. ADC12 internal oscillator times sample (16x)
      // and conversion. In Mainloop MSP430 waits in LPM0 to save power until ADC12
      // conversion complete, ADC12_ISR will force exit from LPM0 in Mainloop on
      // reti. If A0 > 0.5*AVcc, P5.1 set, else reset.
      // ACLK = 32kHz, MCLK = SMCLK = default DCO 1048576Hz, ADC12CLK = ADC12OSC
      //
      // MSP430xG461x
      // -----------------
      // /|\| XIN|-
      // | | | 32kHz
      // --|RST XOUT|-
      // | |
      // Vin -->|P6.0/A0 P5.1|--> LED
      //
      // 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"

      void main(void)
      {
      WDTCTL = WDTPW + WDTHOLD; // Stop WDT
      ADC12CTL0 = SHT0_2 + ADC12ON; // Sampling time, ADC12 on
      ADC12CTL1 = SHP; // Use sampling timer
      ADC12IE = 0x01; // Enable interrupt
      ADC12CTL0 |= ENC;
      P6SEL |= 0x01; // P6.0 ADC option select
      P5DIR |= 0x02; // P5.1 output

      while (1)
      {
      ADC12CTL0 |= ADC12SC; // Start sampling/conversion
      __bis_SR_register(LPM0_bits + GIE); // LPM0, ADC12_ISR will force exit
      }
      }

      #pragma vector = ADC12_VECTOR
      __interrupt void ADC12_ISR(void)
      {
      if (ADC12MEM0 >= 0x7ff) // ADC12MEM = A0 > 0.5AVcc?
      P5OUT |= 0x02; // P5.1 = 1
      else
      P5OUT &= ~0x02; // P5.1 = 0

      __bic_SR_register_on_exit(LPM0_bits); // Exit LPM0
      }

      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 May 04 2012 08:08 AM
      Verified Answer
      Verified by ROHIT JOSHUA
      Guru141810 points

      ROHIT JOSHUA
      Whether our prediction for P6.0

      Yes and no. As I wrote, P6.0/A0 pin is hardwired to the microphone sircuit on the board. So if you feed some analog voltage into it, you're also feedign the microphone circuit. Please check the board schematics! Same for P6.1/P6.2
      P6.3, P6.4 and P6.7 are connected to a filter circuit and P6.5 to the audio output.
      Using any of them for analog input will best case invalidate the signal and worst case overload the signal source.

      This is why I suggested using P5.1/A12 (after pulling J3 and disablign the LED4 attached to it) or P5.0 (apparently not connected to any on-board hardware). Both are accessible on header H9.

      The GND, however, is taken wrong. The pin you marked is H7.1, which is connected to P3.0

      Possible points for GND are JTAG1 (the header below the one you marked), pin 9, or from the breadboard area below the microphone, on the lower right side next to the board border (marked with "-"). The other side of the breadboard (marked with '+') carries VCC, in case you need it.

      About the software, well, doesn't look wrong. (I see, you're using P5.1/LED3 for signalling. SO eithe ryou mcoe to a different LED, or you cannto use it as alternative analog input as suggested above).
      However, I'm no online-code-validator. Try it and see what's happened. And if it doesn't seem to work, tell us what you expected and what you observed instead.

      Note, if changing the input from A0 to something else, you only need to write the change to ADC12MCTL0 (which is currently left to the default, which is A0 for all ADC12MEMx registers). No need to change from ADC12MEM0 to something different.

      _____________________________________
      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.
    • ROHIT JOSHUA
      Posted by ROHIT JOSHUA
      on May 10 2012 01:20 AM
      Prodigy50 points

      huuuurrrrraaaaaahhhhhh sir!!!! :)

      we have found the input pin n the gnd as per u've informed us!!! :) Thank God n Thank you sir!!! :)

      now that we know, the positive pin and the negative pin of the load cell are to be fed to the input pin P5.1 and to Gnd on the bread board respectively!!

      our next hurdle is to display the amount of variation in the voltage when a component is placed on the load cell. so I think we need a program which reads the memory which contains the voltage varaition value from the load cell n displays it on the LCD.

      my doubt is whether ADC12MEM0 is the memory where the value will be stored or is it something else???

      sir can u please send the program asap!!!!! u have helped us alot!!! Thank you once again!!! God be wid u!! :)

      Joshua

      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 May 10 2012 10:08 AM
      Guru141810 points

      ROHIT JOSHUA
      my doubt is whether ADC12MEM0 is the memory where the value will be stored or is it something else???

      It depends on your ADC12 configuration.

      You can see at the ADC12MCTLx registers as a script. Each ADC12MCTLx is a conversion command in this script. It contains the info which analog input is to be sampled, which reference is to be used and whether it is the last instruciton of the 'script'.
      Each conversion result will appear in teh ADC12MEMx register that is associated to the ADC12MCTLx register that controlled the conversion.

      In the main config registers you say whether you want to exdcute a single 'line' of this script (single conversion), a single line over and over again( repeated single conversion), a full script run beginning with a specific 'line' until the 'end of sequence' tag is discovered (sequence of conversions) or running the script over and over again (repeated sequence). However, if using the repeated mdoes (single or sequence) the content of ADC12MEMx is overwritten with each 'run'. So you'll have to read and save it by software, according to your needs. The ADC12IFGx bits tell you when a new value has arrived in a specific ADC12MEMx register. And if you set the ADC12IE bit for the (last, in case of a sequence) ADC12MEMx of interest, you'll get an interrupt if this specific conversion has produced a new result (and in case of a sequence, all previous ones too)

      ROHIT JOSHUA
      sir can u please send the program asap

      Sorry, I already have a fulltime job, and my code belongs to my company (which isn't TI)

      _____________________________________
      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