Skip to content
..because no one suggested a better name for my MSP430 code
C C++ Assembly
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
examples
headers
lib
.gitignore
LICENSE
Makefile
README.markdown

README.markdown

msp3n1s

About

This is my collection of code for the MSP430 Launchpad.

Usage

You'll need to have msp430-gcc and the rest of the MSP430 GCC toolchain installed along with mspdebug. Once that is taken care check out the code like this

$ git clone git://github.com/esmil/msp3n1s.git

Now enter one of the examples directories

$ cd msp3n1s/examples/blink

and do

$ make upload

to build and write the program to your Launchpad. Running make will only build the program.

Headers

The headers subdirectory contains a collection of headers with inline functions, which are basically readable names for what you can do with peripheral registers. Compare

int main(void)
{
    WDTCTL = WDTPW | WDTHOLD;
    P1DIR |= BIT0;

    while (1) {
        P1OUT |= BIT0;
        delay(0xFFFF);
        P1OUT &= ~BIT0;
        delay(0xFFFF);
        }
}

to this program

int main(void)
{
    watchdog_off();
    pin_mode_output(1.0);

    while (1) {
        pin_high(1.0);
        delay(0xFFFF);
        pin_low(1.0);
        delay(0xFFFF);
    }
}

I find that the second program is much easier to read and understand, and since GCC is clever there is absolutely no overhead in doing this. In fact the two programs compile to the exact same thing.

Libraries

The lib subdirectory contains a bunch of code which is meant to be shared among projects. Since programs for the Launchpad tend to be rather small, most of this code is meant to be included directly into your source code using

#include "lib/<library>.c"

This allows the compiler to better optimize the whole program, and throw away unused pieces of code.

All libraries should have at least one program in the examples subdirectory using them.

So far these libraries include

  • onewire.c

    Dallas 1-wire master code.

  • lcd.c

    Code to control Hitachi HD44780-based LCD displays.

  • serial.c

    Software implementation of RS232 serial communication for chips without a UART.

License

msp3n1s is free software. It is distributed under the terms of the GNU General Public License.

Contact

Please send bug reports, patches, feature requests, praise and general gossip to me, Emil Renner Berthing esmil@mailme.dk.

Something went wrong with that request. Please try again.