参考样例的主程序
#ifdef T2_CAP
printf("T2_CAP Test ...\n");
mTimer2ClkFsys();
mTimer_x_SetData(2,0);
CAP2Init(1);
CAP1Init(1);
mTimer2RunCTL(1);
ET2 = 1;
EA = 1;
T2EX = 0;
mDelayuS(500);
T2EX = 1;
mDelayuS(500);
T2EX = 0;
mDelayuS(500);
T2EX = 1;
mDelaymS(1);
mTimer2RunCTL( 0 );
while(1);
#endif
中断服务程序
void mTimer2Interrupt( void ) interrupt INT_NO_TMR2 using 3
{
mTimer2RunCTL( 0 );
#ifdef T2_CAP
if(EXF2)
{
SCK = ~SCK;
Cap[FLAG++] = RCAP2;
printf("RCAP2 %04x \n",RCAP2);
EXF2 = 0;
}
if(CAP1F)
{
Cap[FLAG++] = T2CAP1;
printf("T2CAP1 %04x \n",T2CAP1);
CAP1F = 0;
}
#endif
if(TF2)
{
TF2 = 0;
SCK = ~SCK;
}
mTimer2RunCTL( 1 );
}
#endif
模拟T2ex引脚电平变化,串口没打印出任何东西,不知道为何,请教!