Multiple Launchpads talking to each other
June 25, 2011
I'm about to give up on the Launchpad. No fault of the device, it's just everthing seems to be "roll your own". I see the code and examples for the PICAXE and the whole wide world seem simpler. Can't fault the LP for the price, though. If you have more that one LP you can test your switch sensing code with this example. See embedded video and my spaghetti code below.
// By Voltar. www.ironjungle.com June 2011
// Simple demonstration of multiple MSP430 Launchpads communicating
// with each other in a Master/Slave type relationship.
// All MSP430 are loaded with this exact same code.
// No limit to the number of MSP430 Launchpads.
// The Master Launchpad P1.0 (Red LED Output) is hardwired to
// P1.3 (S2 switch input) on the Slave Launchpad.
// The Master Lauchpad passes control to the adjacent Slave Launchpad.
// That Slave Launchpad then becomes a Master.
// Master MSP430
// | |
// | |
// | |
// | P1.6|-->LED2
// | P1.0|-->LED1 ----->hardwired to P1.3 on the Slave MP430
// | |
WDTCTL = WDTPW + WDTHOLD; // Calm the dog...
P1DIR |= BIT0; // Set P1.0 to output direction (Red LED)
// P1.0 low also triggers Slave MSP430 to run
P1DIR |= BIT6; // Set P1.6 to output direction (Green LED)
volatile long i;
P1OUT = BIT0; // Start with RED LED ON, Green LED off on all Launchpads
while ((P1IN & BIT3)); // Wait for button press on P1.3 to start the fun.
// We also wired P1.3 (INPUT) to P1.0 (Red LED Output)
// for the Slave MSP430. A low P1.0 triggers the Slave MP430.
for (i=0; i<500; i++); // A little delay after the trigger
P1OUT ^= BIT0 + BIT6; // TOGGLE the two LEDs (Red LED off, Green LED on)
for (i=0; i<100000; i++); // This brings P1.0 Low on the Master MSP430 and triggers the Slave MSP430 via P1.3.
P1OUT ^= BIT0 + BIT6; // TOGGLE the two LEDs (Red LED on, Green LED off) and wait for trigger.
} //endless loop // The little MSP430 never gets bored.