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.
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
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?
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.
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...
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
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.
MarcoThe operation of the watchdog is well defined in the users guide of your MSP430.
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.
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/