响应一下~:)
#include
void delay();
unsigned int led_on;
unsigned int i=0;
int main( void )
{
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD;
TACTL=TASSEL1+TACLR;
CCTL0=CCIE;
CCR0=100;
P1DIR|=0x01;
TACTL|=MC0;
_EINT();
while(1)
{
for(led_on=0;led_on0;led_on--)
{
delay();
}
}
// return 0;
}
#pragma vector=TIMERA0_VECTOR
__interrupt void Timer_A(void)
{
i++;
if(i=100)
{
i=0;
}
}
void delay()
{
unsigned int x,y;
for(x=20;x>0;x--)
{
for(y=100;y>0;y--)
{}
}
}