P1_1作为LED灯使能位
#include <iocc2530.h>
#define LED P1_1
#define uint unsigned int
uint count=0;
void init_T1(){
P1SEL &=0xFD;
P1DIR |=0x02;
//晶振设为32MHZ
CLKCONCMD &= ~0x7F;
//等待晶振稳定
while(CLKCONCMD & 0x40);
EA=1;
T1IE=1;
T1CTL=0x05;
LED=1;
}
void main(){
init_T1();
while(1){
}
}
#pragma vector = T1_VECTOR
__interrupt void T1_ISR(){
//清中断标志
IRCON = 0x00;
if(count<300){
count++;
}else{
count=0;
LED=!LED;
}
}