AnsweredAssumed Answered

Input capture issue

Question asked by Guillaume Tiffineau on Apr 14, 2015
Latest reply on Apr 15, 2015 by Guillaume Tiffineau

Hello,

 

I'm using MQX 4.0 with K60.

 

I would like to use input capture on Rising edge or falling edged.

 

I can't succeed to have counting.

 

Here is the code :

 

//Enable FlexTimer 3 Clock

 

    SIM_SCGC3 |= SIM_SCGC3_FTM3_MASK;; /* Enable clock for FTM3 */

 

PORTE_PCR10|= (0|PORT_PCR_ISF_MASK|PORT_PCR_MUX(6));

 

// FTM0_CH5

 

FTM3_MODE |= FTM_MODE_WPDIS_MASK;

 

FTM3_CNT = 0;                //reset the counter to zero

 

FTM3_MOD = 0xffff ;          //Set the overflow rate

 

FTM3_CNTIN = 0;             //Set the Counter Initial Value to 0

 

FTM3_MODE |= FTM_MODE_FTMEN_MASK;

 

// FLEX Timer0 configuration

 

FTM3_SC |= (FTM_SC_PS(0)| FTM_SC_CLKS(1));  

 

// TOF=0 TOIE=0 CPWMS=0 CLKS=01 (system clock)  (divide by 1) 

 

FTM3_C1SC = 0;    /* Clear channel status and control register */

 

FTM3_C2SC = 0;    /* Clear channel status and control register */

 

FTM3_C3SC = 0;    /* Clear channel status and control register */

 

FTM3_C4SC = 0;    /* Clear channel status and control register */

 

FTM3_C5SC = 0;    /* Clear channel status and control register */

 

FTM3_C6SC = 0;    /* Clear channel status and control register */

 

FTM3_C7SC = 0;    /* Clear channel status and control register */

 

  

 

FTM3_C5SC |= (0|FTM_CnSC_ELSA_MASK | FTM_CnSC_CHIE_MASK);

 

FTM3_MODE |= FTM_MODE_FTMEN_MASK;

 

FTM3_COMBINE = 0;

 

FTM3_QDCTRL = 0;

 

   

 

//Enable the counter to run in the BDM mode

 

FTM3_CONF |= FTM_CONF_BDMMODE(0); 

 

Can you help me please ?

 

Regards,

 

Guillaume

Outcomes