#include "time1.h"
#include "uart.h"
void Time1_Init(void)
{
TA1CCR0 = 10000; //10MS
TA1CCR1 = 20000;
TA1CCR2 = 40000;
TA1CCTL0 = OUTMOD_4+CCIE;
TA1CCTL1 = OUTMOD_4+CCIE;
TA1CCTL2 = OUTMOD_4+CCIE;
TA1CTL = TASSEL_2+MC_2+TAIE;
_EINT();
}
#pragma vector=TIMER1_A0_VECTOR
__interrupt void Timer1_A0 (void)
{
static unsigned int timeccr0 = 0;
TA1CCR0 += 10000;
timeccr0++;
if(100 == timeccr0)
{
timeccr0 = 0;
UartSendStr("0000000\r\n");
}
}
#pragma vector = TIMER1_A1_VECTOR
__interrupt void Timer1_A1(void)
{
static unsigned int timeccr1 = 0,timeccr2 = 0,timetaiv = 0;
switch(TA1IV)
{
case 2:
TA1CCR1 += 20000;
timeccr1++;
if(100 == timeccr1)
{
timeccr1 = 0;
//UartSendStr("1111111\r\n");
}
break;
case 4:
TA1CCR2 += 40000;
timeccr2++;
if(100 == timeccr2)
{
timeccr2 = 0;
UartSendStr("2222222\r\n");
}
break;
case 10:
timetaiv++;
if(15 == timetaiv)
{
timetaiv = 0;
//UartSendStr("3333333\r\n");
}
break;
}
}