Hello Hack-A-Day and Dangerous Prototypes readers! Please vote for me in the Sparkfun uC Contest! (If you vote for me you can still vote for other projects as well) The vote button is just up and left of here... there you go... closer... closer... I know you can do it...
1.) I do, in fact, own an Arduino and despite this being a microcontroller project on Instructables, an Arduino is NOT a part of this guide. An Arduino has it's specific uses and fills a niche in my toolkit very well but Arduino is usually not my first choice when deciding which platform I'll prototype my latest idea with. One of the best parts of the Arduino platform is that it is streamlined to the point that anyone can use it without being an engineer. However, someone serious about the code they are writing for their project, will before long, need an essential feature: in-circuit debugging. We'll go over why ICD is so great and discuss how to use it as we build this simple project.
2.) What the heck is a Pomodoro timer, you ask? The Pomodoro technique is a means of time management created by Francesco Cirillo. You can find lots more information here: http://www.pomodorotechnique.com/ Personally, I love the Pomodoro technique but didn't want to run yet another application on my computer. Thus, I needed a simple timer. If you don't need or want a Pomodoro timer, the end result of this Instructable isn't as important as the means of getting to it and learning how to debug. What I really want to teach is some simple debugging concepts your average Arduino user may not know they are missing out on.
3.) This project is based around the Texas Instruments LaunchPad development board, an MSP430G2211 and five LEDs. If you don't have a Launchpad and have any interest in embedded programming at all, please just order one now. You can thank me later.
Take a look at the final step for the components needed for the pomodoro timer, if you're interested in making one.
4.) IAR Embedded Workbench Kickstart for MSP430 is the development environment we'll be using. Download it from here: http://www.ti.com/iarkickstart This is unfortunately a Windows-only IDE, but it runs in various virtual machines on both Linux and OS X. For this Instructable, I'm using Parallels on OS X. If there is sufficient interest, I'll write a guide for MSP430 development using FOSS tools on OS X.
Remove these ads by
Signing UpStep 1: Putting the prototype board together
Remove the TXD, RXD, and P1.6 jumpers from the board. Put the microcontroller in the Launchpad if you haven't already. The groove in the microcontroller goes towards the USB connector.
LEDs don't work if put in backwards so pay attention to their polarity. Here is a quick primer if needed: http://www.sparkfun.com/tutorials/222. Thanks Sparkfun!
For all five LEDs, bend the cathode straight out. (That's the short leg). Put the LEDs, 100ohm resistor, and paperclip together like they are in the picture. I'd prefer a bit solder to the paperclip, but we're keeping things as simple as possible.
The LEDs, one each, are in ports P1.1 – P1.5. The paperclip prototyping method seen below works in lieu of solder. The 100 ohm resister completes the LED's path to GND.
My piezo speaker was a lucky find as it already had a .1” pitch header on it. It that is the case, you can remove the P1.6 jumper and attach the speaker directly to the board. Otherwise, you need to make a connection from P1.6 through the speaker to GND.
For those that want to make this a stand-alone device, the final schematic is included in this guide on the last page.











































Visit Our Store »
Go Pro Today »




It's probably absurd that I understand all that without knowing any programing languages. Time to learn C! :)
Looking at the screenshot in Step 3, you did not intend this.
I though it was an intentional bug at first, until I kept reading.
In the meantime, I am still trying your example. I am not familiar with C, MSP430s, IAR, or really any of it. I understand the basics of programing and circuits, but despite having compiled and downloaded the code, all I have managed to do is get the P1.3 LED to glow dimly and continuously. The other LEDs and buzzer show no signs of anything. I have tested the LEDs through the paperclip junction (alligator clip on mine) for continuity, and the joint is good. I have rearranged the LEDs and moved the buzzer between the two acceptable location to no avail. I haven't noticed any magic smoke. Do you have any ideas for what I could be doing wrong and/or how to correct it?
As for getting the LEDs to turn on, try stopping execution after this line:
P1OUT |= (LED0 + LED1 + LED2 + LED3 + LED4 + BUZZER);
At that point, you should have 5v coming from P1.1-5. It may be best to test each point individually with a multimeter or move the LED->alligator/paperclip->resistor bridge to each point. There isn't really any need to test the buzzer at that point.
I tried your suggestion, and I am getting 1.6V on P1.3, independently of wherever I stop it. No other pin is supplying voltage. I think I must have a download error, or a dead chip. I'll have to find a way to test that, I guess.
#define LED4 BIT1
#define LED3 BIT2
#define LED2 BIT3
#define LED1 BIT4
#define LED0 BIT5
#define BUZZER BIT6
void main( void ) {
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD;
// Set DCO to 1MHz factory calibration value
BCSCTL1 = CALBC1_1MHZ;
DCOCTL = CALDCO_1MHZ;
//all LED pins and buzzer as output
P1DIR |= (LED0 + LED1 + LED2 + LED3 + LED4 + BUZZER);
P1OUT |= LED0;
P1OUT &= ~LED0;
P1OUT |= LED1;
P1OUT &= ~LED1;
P1OUT |= LED2;
P1OUT &= ~LED2;
P1OUT |= LED3;
P1OUT &= ~LED3;
P1OUT |= LED4;
P1OUT &= ~LED4;
while(1){} //do nothing forever...
Step through all the P1OUT lines individually to make sure they are turning the correct pin on and off.
I noticed my error while setting up a Workspace for your test code. It turns out that my problem was scrolling my mouse wheel after selecting "FET Debugger" under "Driver," so that I had inadvertently been working under "Simulator." I ran your "helloworld" to confirm that my hardware worked, and then re-ran your Step 2 code.
I guess I will just have to try a hello world to each of the pins tomorrow to see if I can isolate the problem.
+1 for interest on this topic! I just got a couple Launchpads for my first ever foray into uC programming and I'll soon be getting an OS X machine. Being able to use those together would be awesome.
Seriously, though, I think that'll be my next Instructable.
PS... seriously, though, vote for me!
Also just a reminder for everybody, two diodes rated at 1A each placed in parallel does NOT mean you can let 2A through, unless the diodes are absolutely identical, which is almost impossible in the real world. One will let more current flow through than the other, and that one gets warmer, and actually increases its conductance.
Debugging, not the circuit, is the emphasis of the tutorial. From personal experience, MSP430G2xxx's are able to both sink and source much more than the datasheet specifies so I felt comfortable with extremely easy solution.
That obviously shouldn't be relied on for a critical project but for this purpose, the single GND port can be used for the sake of convenience.