Home > Uncategorized > Understanding Timers in MSP430

Understanding Timers in MSP430

We will understand the concept of timer by writing an actual software. The purpose of the program is to generate well defined pulse(s) of alternate high and low. This is something simple, but the key here is to understand the Timer concept rather than generating the square pulse. You will need an oscilloscope to capture the high low sequence.

Preparing your hardware

Before we start our experiment, let us make sure that our hardware is in place. We do this by writing the following code and checking that we are getting high ( or low ) at an IO port of the board we are testing. In out case it is P6.3, but you can use any other port.

Use the following code and make sure that the P6.3 ( or your chosen port) turns high and low before you start experimenting.

#include "msp430x14x.h"

void main(void)
P6DIR |= 0x08; // P6.3 Set P6.3 to output
P6OUT &= ~0x08; // P6.4 is low
//P6OUT |= 0x08; // Use this if you want to check for high output.

In the next page we will write the actual code that will run timer.


  1. No comments yet.
  1. No trackbacks yet.