Although there are many resources dedicated to teaching microcontrollers and the MSP430 in particular, we have always found that they failed to cover the basics, or made too many assumptions that were not valid when transitioning from a computer programming environment. Some seemed to assume you already had years of experience using microcontrollers. While this might be true, the MSP430, like any other microcontroller, has peculiarities that need to be explained and understood.
Programming for embedded systems and the MSP430 is not more difficult than programming an x86 on Windows or Linux. In fact, it is much better in that it exposes us to the little details of how the system operates (the clocks, I/O) at a level that anyone can learn. However, it does force us to make critical decisions that affect how the application runs. The MSP430 microcontroller is an extremely versatile platform which supports many applications. With its ultra-low power consumption and peripherals it enables the designing engineer to meet the goals of many projects. It has, of course, limitations. It is geared mostly towards low energy and less intensive applications that operate with batteries, so processing capabilities and memory, among other things, are limited.
This tutorial will begin from the basics, introducing you to the number system theory necessary to manipulate binary digits and digital logic as used in the microcontroller and all computers. Once this is understood, you will be able to see how to manipulate the registers which control the operation of all microcontrollers. It will then cover the specifics of modules in the MSP430, from both the hardware and software perspective. We decided to follow this format primarily because you, the reader, might want to use this tutorial as a reference and just jump to a module you need help with. But we also wanted to keep the tutorial to be accessible for beginners and so the first part of the tutorial looks to lay a good foundation.
To those who are unfamiliar with microcontrollers, they might seem extremely simple and rare as compared to personal computers. However, microcontrollers and microprocessors are embedded in many devices, with hundreds of them forming part of today’s automobile, controlling everything from the engine to the sound system. Cellular phones include more sophisticated microprocessors, but these are not as different from the MSP430 that we will cover here in that the basics apply to both. The power of microcontrollers lies in their small size and adaptability. As opposed to fixed digital circuitry, microcontrollers can be programmed to perform many applications and can be later changed when improvement are required. This saves both time and money when a field upgrade is required (which you will discover to be a grand objective of any company). However, there are limitations with respect to processing power and memory (the two biggest problems you face the use of embedded processors). It is the job of the engineer to come up with the requirements of the application and select the proper device for the application. With the advances in processing capability, many more applications can be realized today with microcontrollers than ever before, especially due to their low power profile. Below we show a block digram of everything integrated inside a MSP430G2553 Microcontroller. You can see that it contains not just a CPU, but memory, non-volatile storage and many peripherals that are useful in real life applications.
A wide array of microcontrollers exist, far surpassing the capabilities of full-fledged computers in the 70s, 80s, and even 90s. UV Erasure of microcontroller and ROM are today mostly a thing of the past. With the advent of Flash memory, the microcontroller can be programmed hundreds of thousands of times without any problems. Also, they incorporate a wide array of modules such Analog to Digital Converters, USB, PWM, and Wireless transceivers, enabling integration into any kind of application. Low cost development tools, both hardware and software, allow anyone to start building a system. The knowledge of doing so is also more widespread. Still, no matter how good are the tools, they can never substitute real knowledge about the inner workings of microcontrollers. This is what this tutorial is about.