//this routine will just setup and run a 
//PWM out of P4.0 and 4.1
#include "include\MSP430x14x.h"
void PWM(void)
{
//PWM to the motors are on channel PWM1 and PWM2.
//this is so that CCR0 can be used with the timer up/down mode
//define the two PWM's on 4.1 and 4.2 as outptus and second fucntion
P4DIR |= 0x06;
P4SEL |= 0x06;

//need to define the brake and DIR pins as outputs.

P5OUT = 0x05;
P5DIR |= 0x0f;

 //Now set timer B for PWM mode using SMCLK
//first stop and clear the counter AND USE smclk
TBCTL = (TBSSEL1 | TBCLR);
//Then set what to count up to.
TBCCR0 = 500;  //Which makes timer B divided by 500
//Then set up compare fucntions
TBCCTL1 = 0x0240;
TBCCTL2 = 0x0240;
//Then the width of the pulse SET TO 1/4
TBCCR1 = 0;
//Then the width of the pulse SET TO 3/4
TBCCR2 = 375;
//Now startup Timer B IN UP/DOWN MODE
TBCTL |= (MC1 | MC0);

}//End of PWM