Introduction to MSP430 Interrupts

In this tutorial, we will see an effective way on coding interrupts. Our task for today will be to learn interrupts for GPIO and Timers. In the initial part, we will first have a look on coding interrupts for the GPIO pins and in the later half we will modify this code to add interrupts for timers. By the end of the tutorial you will have a code that will blink a led using timer interrupt, however the blinking frequency will vary if you push a button. In the last tutorial on timers, we saw that we were continuously monitoring the timer flag to check when the timer has overflown. This process is called polling. The only problem with this method is it keeps the processor busy. What if we… Continue reading

Timers of MSP430

In the last tutorial, we had a look at configuring clocks or rather internal clocks of the MSP430. Since you are now at a stage where you can configure clocks on your own, we can use them to access various functionality of the MSP430. All of the major functions such as the ADC, timers, e.t.c rely upon the clock or the clock speed at which the microcontroller is functioning. Timers of any microcontroller are special registers that increment or decrement their value automatically. They are an integral part of the microcontroller and are used in almost every project from basic to complicated one. A good feature of the timers of the MSP430 you can use them to achieve real time clock i.e a delay of exactly 1 sec, provided you… Continue reading

Configuring the DCO of MSP430

Clocks are the most important part of any microcontroller. These are the first thing one should know while beginning to use any feature of the controller whether it’s timer, interrupts, or ADC’s. All of them rely on the clock setting of the microcontroller and works accordingly. The MSP430 is not so different. However, it features a very easy to configure clock settings which might look a bit tough initially but once you get used to it, you will find it amazing to use. Unlike AVR, where you use super complicated fuse bits to change your clock source as well as the frequency, this is not the case with the MSP430. The clocks are easily configurable and importantly if you are using internal clock you can change its frequency at any… Continue reading

Connecting buttons to MSP430

In this new tutorial, we will see the easiest way to connect a push-button to the MSP430. I will be using msp430 Launchpad for the purpose of the tutorial, however you can use a bread-board too externally interface the push-button Before I begin, I want to tell you the advantage of Msp430 over other sets of microcontroller available in the market.  As you might have seen, msp430 is a pretty cheap microcontroller from the Texas family, and has a 16-bit wide data bus for processing the data but has very few number of pins. Only 2 ports of 8pins each are available for interfacing and that two without support for external crystal. If you want to connect an external crystal, you lose two more pins and that reduces the total… Continue reading

Blinking the LED with MSP430

This is the second tutorial on MSP430 and it will feature code on blinking the led’s and hence will tell you on how to configure the ports as input and output, and how to make the port low and high when it’s declared as output. For those having a MSP430 launchpad, it has two on-board led’s connected via two jumpers to pins p1.0 and p1.6. Our task for today is to blink these led’s alternatively or toggle them. To start with open code composer studio, go to FILE->NEW->CCS PROJECT. After doing this, you will get a window mentioned below Enter your project name, select family as MSP430 and now variant is msp430g2253. Remember, this is a important step. To check your variant, refer your chip on the Launchpad. It clearly… Continue reading