#include "msp430g2553.h"
static long int RCC;
static unsigned int DIR;
void delay_nus(unsigned n)
{
unsigned int i,j;
for(i=0;i
{
for(j=0;j<100;j++);
}
}
int main( void )
{
// Stop watchdog timer to prevent time out reset
DIR = 1;
RCC = 500;
WDTCTL = WDTPW + WDTHOLD;
//IO set
P1DIR |= 0x41;
P1SEL |= BIT6;
//clc set
CCR0 = 1000;
TACCTL0 = CCIE;
CCTL1 = OUTMOD_7;
TACTL = TASSEL1+MC_3; //source + mode
__enable_interrupt();
while (1);
}
#pragma vector = TIMER0_A0_VECTOR
__interrupt void Timer_A(void)
{
P1OUT ^=0x01;
if(DIR == 1)
{
RCC -= 10;
if(RCC<0) DIR = 0;
}
if(DIR == 0)
{
RCC += 10;
if(RCC>950) DIR = 1;
}
CCR1 = RCC;
delay_nus(70);
}