MSP430
(Redirected from Launchpad)
intro
Stolen from TI's wiki page:
"The MSP430 is a 16-bit, ultra-low power, mixed signal microcontroller from Texas Instruments. The strengths of the MSP430 lie in its easy-to-learn, C-compiler friendly, 16-bit CPU partnered with flexible low power modes and intelligent, low-power peripherals. As a catalog market product, its versatility is applied across a number of different end-equipments including medical equipment, electricity and sub-metering, and home appliances such as smoke detectors, thermostats, etc... With over 230 parts available, there is likely to be an MSP430 for almost any application."
More information at ti.com/430value
MSP430 LaunchPad
The space got two Texas Instruments MSP430 LaunchPad development kits donated, free for use within the space.
Each LaunchPad kit includes the following:
- Quick start guide
- MSP-EXP430G2 development/debugging PCB
- MSP430G2231 IC (included on the PCB)
- MSP430G2211 IC
- 2x 10 pins header M/F for extension boards
- micro crystal 32.768kHz
- USB->mini-USB cable
See ti.com/launchpadwiki for more information
project
- One idea is to drive an HD44780 (hitachi standard LCD) character display
Note by CoolePascal, driving an HF44780 requires at least 6 pins which does not leave much pins to do something usefull
- Another thing to do, is read a PS/2 Keyboard.
thereifixedit
How-To
Based on Debian 6.0
Most info from [1]
INSTALLING :
# Install required packages: sudo aptitude install git-core gcc-4.4 texinfo patch libncurses5-dev zlibc zlib1g-dev libx11-dev libusb-dev libreadline6-dev Download and compile mspgcc: git clone git://mspgcc4.git.sourceforge.net/gitroot/mspgcc4/mspgcc4 cd mspgcc4 sudo sh buildgcc.sh Press enter to use the default answers when the scripts ask you. Only write yes when it ask “Do you want to start build right now? (y/n) [n] ” because the default is no. ATTENTION this will take some time depending on the speed of your machine (30-60min) # Download and compile mspdebug: wget -O mspdebug.tar.gz http://sourceforge.net/projects/mspdebug/files/latest tar -zxvf mspdebug.tar.gz cd mspdebug make sudo make install # Create a udev rule to be able to use the usb debug shield sudo nano /etc/udev/rules.d/46-TI_launchpad.rules Now paste inside the following rule: ATTRS{idVendor}=="0451", ATTRS{idProduct}=="f432", MODE="0660", GROUP="plugdev" Restart the udev service: service udev restart
COMPILE / RUN :
# Compile the source code and create de elf file data to be uploaded to the chip: /opt/msp430-gcc-4.4.5/bin/msp430-gcc -Os -mmcu=msp430x2231 -o led.elf led.c # Connect the platform to the pc and upload the program to chip: mspdebug rf2500 prog <.ELF FILE> run
PROGRAMS :
Counter : Loop Lights no LED, red LED, Green LED, Both LEDs
Code dirived from blinking led sample.
counter.c
#include <msp430g2231.h> /** Delay function. **/ delay(unsigned int d) { int i; for (i = 0; i<d; i++) { nop(); } } int main(void) { int i; WDTCTL = WDTPW | WDTHOLD; P1DIR = 0xFF; P1OUT = 0x01; while (1) { for (i = 0 ; i<4 ; i++) { int table [4] = {0,1,64,65}; // get values from table // 0 = off , 1 = red , 64 = green , 65 = both P1OUT = table[i]; delay(0x4fff); delay(0x4fff); delay(0x4fff); delay(0x4fff); }
Knopje
switch2.c
#include <msp430g2231.h> int main(void) { // Reset bord WDTCTL = WDTPW | WDTHOLD; // P1DIR bepaald output pinnen // P1.0 = Rood 0x01 , P1.6 = Groen 0x40 #define ROOD 0x01 #define GROEN 0x40 #define KNOP 0x08 P1DIR = 0x41; P1OUT = 0x00; while (1) { // P1.3 is linkerswitch if (!(P1IN & KNOP)) { P1OUT = GROEN; } else { P1OUT = ROOD; } } }
Counter + Knopje
knipper1.c
include <msp430g2231.h> #define ROOD 0x01 #define GROEN 0x40 #define KNOP 0x08 /** Delay function. **/ delay(unsigned int d) { int i; for (i = 0; i<d; i++) { nop(); } } int main(void) { // Reset bord WDTCTL = WDTPW | WDTHOLD; // P1DIR bepaald output pinnen // P1.0 = Rood 0x01 , P1.6 = Groen 0x40 // P1.3 = Linkerknop P1DIR = 0x41; P1OUT = 0x00; while (1) { P1OUT = 0x00; while (!(P1IN & KNOP)) { int i; for (i = 0 ; i<4 ; i++) { int tabel [4] = {0,1,64,65}; // haal waarde uit tabel P1OUT = tabel[i]; delay(0x4fff); delay(0x4fff); delay(0x4fff); delay(0x4fff); } } } }
Location: stACKspace (on the panel meter ad a demo device)