AnsweredAssumed Answered

K60 Input Capture

Question asked by FeiYang on May 21, 2012
Latest reply on Mar 8, 2013 by Adrian Sanchez Cano

Hi! All:


I am using one of the K60 Flex Timer (FTM) modules to act as Input Capture,and the only setup for the FTM I do is:

void FTM_InputCapture_init( void )
{   
     SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK;
     PORTA_PCR4 |= PORT_PCR_MUX(0x3);  //引脚PTA4设置为 FTM0_CH1功能
      FTM0_C1SC &= ~FTM_CnSC_CHF_MASK;
      FTM0_C1SC |= FTM_CnSC_CHIE_MASK;
      FTM0_C1SC &= ~FTM_CnSC_MSB_MASK;          
      FTM0_C1SC &= ~FTM_CnSC_MSA_MASK;   
      FTM0_C1SC |= FTM_CnSC_ELSB_MASK;   //下降沿触发
      FTM0_C1SC &= ~FTM_CnSC_ELSA_MASK;
      FTM0_SC |=FTM_SC_CLKS(0x01);
      FTM0_SC |=FTM_SC_PS(2);
       
      FTM0_MODE &= ~FTM_MODE_FTMEN_MASK;  
      
      FTM0_COMBINE=0;      //DECAPEN=0,双边沿捕捉禁止,COMBINE=0,不级联
      FTM0_C1SC &= ~FTM_CnSC_CHIE_MASK;

      enable_irq (62);
}

However,it doesn't work;it is unable to enter the interrupt program.What am I doing wrong?

Outcomes