• 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 » MSP430 CCStudio Syntax
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

    MSP430 CCStudio Syntax

    This question is answered
    Simon Markham
    Posted by Simon Markham
    on Sep 07 2012 04:44 AM
    Prodigy230 points

    I'm sure that its been asked loads and in the Wiki somewhere, but is there a definitive syntax listing, if so can someone give a link to it please?

    Yours Simon M.

    MSP430 CCSTUDIO syntax
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • Marco
      Posted by Marco
      on Sep 07 2012 09:44 AM
      Expert1420 points

      Hello,

      I am not sure what you mean with your question, but if you where asking for C-syntax, a good point to start is 

      http://en.wikipedia.org/wiki/C_syntax

      and the holy bible of C:

      http://en.wikipedia.org/wiki/The_C_Programming_Language

      Regards Marco

      MSP430 C_syntax
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Simon Markham
      Posted by Simon Markham
      on Sep 07 2012 12:58 PM
      Prodigy230 points

      Ok this wasn't very clear on my part.

       by reading other listings I have discovered that " WDTCTL = WDTPW + WDTHOLD"  is to do with the watchdog timer. BUT where could I look for such syntax in the first place, and how to use it? is it in the headers I wonder?

      Yours Simon M.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Marco
      Posted by Marco
      on Sep 07 2012 15:01 PM
      Expert1420 points

      Hello,

      http://en.wikipedia.org/wiki/Watchdog_timer

      WDTCTL = WDTPW + WDTHOLD  means that you stop the watchdog. For this you require some kind of password (WDTPW).

      The operation of the watchdog is well defined in the users guide of your MSP430.

      Regards Marco

      MSP430 watchdog
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Andy Neil
      Posted by Andy Neil
      on Sep 08 2012 04:20 AM
      Guru31775 points

      WDTCTL  represents a register in the microcontroller, and WDTPW and  WDTHOLD are values to write to that register.

      As  Marco said, the operation of the watchdog - including its registers -  is well defined in the users guide of your MSP430...

       

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Simon Markham
      Posted by Simon Markham
      on Sep 08 2012 14:46 PM
      Prodigy230 points

      I think this is concentrating on the watchdog stuff, but what if I wanted to use I2c, SPI or any other feature of my chosen processor. Will I need to look at the .h file? At the moment it seems that if I want to use assembler I look at the data sheet on how to use peripherals, but if I want to use C, I have to find an example and rip out the sections I like and re use.  or am I missing something

      Yours Simon M.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Marco
      Posted by Marco
      on Sep 09 2012 01:59 AM
      Verified Answer
      Verified by Simon Markham
      Expert1420 points

      Hello,

      all Registers of the MSP430 you use are abstracted in the C header file of your MSP430. If you include it, you can access the registers by just assigning a value to it. The values are also abstracted in the header file for easy use.

      Ususally you will include the master MSP430 include file :

      #include <msp430.h>

      Within this file are all MSP430 device specific include files (from all known MSP430 device types)

      The correct include file is selected by the preprocessor by checking for a definition which is set by the build environment (CCS,IAR,GNU ...). In the SDK you will usually have to set the MSP430 type somewhere, which sets this definition.

      e.g.:

      #if defined (__MSP430C111__)

      #include "msp430c111.h"

      This will include the correct include file for MSP430C111. __MSP430C111__  is defined by the build environment and is added to the compiler invocation by the build system.

      Within this header file (msp430c111.h) is a section, where the watchdog timer register is defined, and also all the control bits of the whatchdog timer register are defined.

      So instead of moving a value to a register with assembler, you will just assign a value to the register in C.

      That applies for all modules of your MSP430.

      Regards Marco

       

       

      MSP430 C
      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 Sep 11 2012 07:44 AM
      Guru139900 points

      Marco
      The operation of the watchdog is well defined in the users guide of your MSP430.

      Not only this. The users guide also describes all registers of all modules (including those only present in a different MSP of the same family but not in yours), along with giving them a name and naming the bits inside these registers. Those names are provided as defines in the header files for this processor (as Marco has already explained). So if you have an MSP tha thas a certain module, the users guide will tell you the register and settigns names for htis module and the header wile should define them. (except for bugs in the header files, but there are usually found and fixed quickly).

      However, besides these symbols that are defined int eh header files, there are so-called intrinsics. These are not define din teh header files but directly provided by the compiler asa (oftne non-portable) extension to the C language, because there are things tha tare needed for microcontroller programming that are not possible to express in the scope of the C standard. Such as accessing the processor status register to enable interrupts etc.)

      Those interinsics are listed in the compiler manual, and different compilers may have different intrinsics for the same job, or support more things than other compilers.
      Examples are _bis_SR_register() or _delay_cycles().

      _____________________________________
      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.
    • Andy Neil
      Posted by Andy Neil
      on Sep 19 2012 15:14 PM
      Guru31775 points

      Simon Markham
      if I want to use assembler I look at the data sheet on how to use peripherals, but if I want to use C, I have to find an example and rip out the sections I like...

      There is, of course, nothing to stop you working direct from the datasheet in 'C'.   At the end of the day, the processor neither knows nor cares what language you wrote your source code in!

      But TI have helpfully provided ready-made headers and examples to save you having to do all this donkey-work yourself. This does, of course, require you to be proficient in the 'C' programming language.

      Here's some resources to help with learning the 'C' programming language:  http://blog.antronics.co.uk/2011/08/08/

       

      learning C
      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