Tux trifft MSP430-Launchpad
Aus BraLUG-Wiki
(Unterschied zwischen Versionen)
(→Weiterführende Links) |
(→Das Programm) |
||
Zeile 16: | Zeile 16: | ||
="Hello World"= | ="Hello World"= | ||
==Das Programm== | ==Das Programm== | ||
+ | |||
+ | <pre> | ||
+ | #include <msp430.h> | ||
+ | |||
+ | #define LED_RED (1 << 0) // rote LED an PIN0 | ||
+ | #define LED_GREEN (1 << 6) // gruene Led an PIN6 | ||
+ | |||
+ | //*************************************** | ||
+ | void delay_ms(unsigned int ms){ | ||
+ | while(ms--){ | ||
+ | __delay_cycles(1000); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | //*************************************** | ||
+ | //*************************************** | ||
+ | //*************************************** | ||
+ | int main(void) | ||
+ | { | ||
+ | WDTCTL = WDTPW + WDTHOLD; // watchdog ausschalten | ||
+ | P1DIR |= LED_RED | LED_GREEN; // LED-Pins als Ausgaenge | ||
+ | P1OUT = 0; // alle LEDs aus | ||
+ | P1OUT |= LED_GREEN; // gruene LED ein | ||
+ | while(1) { // Enlosschleife | ||
+ | P1OUT ^= LED_RED + LED_GREEN; // LEDs toggle | ||
+ | delay_ms(500); // 500ms Pause | ||
+ | } | ||
+ | } | ||
+ | </pre> | ||
+ | |||
==Übersetzen== | ==Übersetzen== | ||
==Flashen== | ==Flashen== |
Version vom 27. Juni 2013, 20:55 Uhr
Derzeit noch Baustelle...!
Inhaltsverzeichnis |
Warum ein MSP430-Launchpad?
Hardware
MSP430
MSP430-Launchpad
Toolchain
"Hello World"
Das Programm
#include <msp430.h> #define LED_RED (1 << 0) // rote LED an PIN0 #define LED_GREEN (1 << 6) // gruene Led an PIN6 //*************************************** void delay_ms(unsigned int ms){ while(ms--){ __delay_cycles(1000); } } //*************************************** //*************************************** //*************************************** int main(void) { WDTCTL = WDTPW + WDTHOLD; // watchdog ausschalten P1DIR |= LED_RED | LED_GREEN; // LED-Pins als Ausgaenge P1OUT = 0; // alle LEDs aus P1OUT |= LED_GREEN; // gruene LED ein while(1) { // Enlosschleife P1OUT ^= LED_RED + LED_GREEN; // LEDs toggle delay_ms(500); // 500ms Pause } }
Übersetzen
Flashen
Debuggen
Ausblick
Weiterführende Links
- http://www.mycontraption.com/programming-the-msp430-launchpad-on-ubuntu/
- http://manpages.ubuntu.com/manpages/precise/man1/mspdebug.1.html
- http://wiki.ubuntuusers.de/MSP430-Toolchain
- http://www.itopen.it/2013/03/01/msp430-energia-on-linux/
- http://losinggeneration.homelinux.org/2010/07/02/msp430-launchpad-on-linux/
- http://recursive-labs.com/static/courses/rl100/samples/mspstart.pdf
- http://launchpadlinux.blogspot.de/2012/10/making-thinks-easier-with-make-and-geany.html
- http://dbindner.freeshell.org/msp430/
- http://gpio.kaltpost.de/?cat=55