MSP430 interrupt driven PWM

this is the code for a PWM, using the WDT as an interval timer.

//options for interval timer
/* WDT is clocked by fSMCLK (assumed 1MHz)
WDT_MDLY_32 (WDTPW+WDTTMSEL+WDTCNTCL)  32ms interval (default)
WDT_MDLY_8 (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS0)  8ms ”
WDT_MDLY_0_5 (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1)  0.5ms ”
WDT_MDLY_0_064 (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1+WDTIS0)  0.064ms ”
WDT is clocked by fACLK (assumed 32KHz)
WDT_ADLY_1000 (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL)  1000ms ”
WDT_ADLY_250 (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS0)  250ms ”
WDT_ADLY_16   16ms ”
WDT_ADLY_1_9   1.9ms ”
interval x PERIOD = period interval    .064ms x 200 = 12.8ms or 78.125hz */
#include <msp430x20x2.h>
#include <signal.h> //add for interrupt
#define PERIOD 200  //defines frequency
volatile  int timer = 0; //counts how many interrupts have been called
//resets when it counts to PERIOD
volatile  int duty_cycle = 0;// max = PERIOD - 1 and min = 1
void main(void)
{
WDTCTL = WDT_MDLY_0_064; //interval setting
P1DIR |= BIT0;
P1OUT |= BIT0;
IE1 |= WDTIE;
eint(); //enable interrupt
}//end main
interrupt(WDT_VECTOR) watchdog_timer(void)
{
++timer;
if (timer == PERIOD) { timer = 0; P1OUT |= BIT0;  }
if (timer == duty_cycle ) { P1OUT ^= BIT0; }
}//end interrupt

a quick demo using my rgb light

sorry for the sound, i forgot to turn off my TV lol