我是这么做的,控制空外对管发射,也是用2530,主频是32M
void T3_Init(void)
{
T3CTL |= 0xA0;//32分频
T3CTL |= 0x02;//模计数
T3CC0 = 0x64;
T3CTL |= 0x10;
T3CCTL0 |= 0x44;
T3CTL |= 0x08;//中断使能
T3IE = 1;
EA = 1;
}
void T4_Init(void)
{
P1DIR |= (0x01 << 1);
P1SEL |= (0x01 << 1);
CLKCONCMD = 0; //32M
T4CTL |= 0x40; //4分频,4/32000000=0.125us
T4CTL |= 0x02; //模计数
T4CC0 = 211; //
T4CC1 = 70;
T4CCTL1 = 0x1C;
T4CTL |= 0x10; //启动
T4CTL |= 0x08 ; //开溢出中断
T4IE = 1; //开总中断和T4中断
EA = 1; //开总中断
}
|