AnsweredAssumed Answered

Combine mode

Question asked by mickholmark on Apr 12, 2013
Latest reply on May 1, 2013 by EARL GOODRICH

Hi

I am sitting and using the FTM for capture mode on rising

edge. I am trying to detect a frequenzy between two rising

edge.

Its working also good when i make a preescale at 16 but i

wont to work with out a preescale and using 32 bit. I know i

can combine to channelse FTM0_C0V and FTM0_C1V in pwm

mode but have to do it in capture mode?

i but my code under so you can see

 

void ftm_init()

{

 

        //Enable clock

        POWER_UP(6, SIM_SCGC6_FTM0);

    

        PORTC_PCR1 |= PORT_MUX_ALT4;//s. 266

        PORTC_PCR2 |= PORT_MUX_ALT4;//s. 266

        

        //FTM0_COMBINE = 0x32;

        FTM0_COMBINE = 0xFFFF;

        

        FTM0_CNT = 0x0000;

        // modulo to max

        FTM0_MOD = 0xffff;

        

    

        

        FTM0_C0SC &= ~FTM_CSC_CHF;    

        FTM0_C0SC |= FTM_CSC_CHIE;

        FTM0_C0SC &= ~FTM_CSC_MSB;

        FTM0_C0SC &= ~FTM_CSC_MSA;

        FTM0_C0SC &= ~FTM_CSC_ELSB;

        FTM0_C0SC |= FTM_CSC_ELSA;

        

        

        FTM0_C1SC &= ~FTM_CSC_CHF;    

        FTM0_C1SC |= FTM_CSC_CHIE;

        FTM0_C1SC &= ~FTM_CSC_MSB;

        FTM0_C1SC &= ~FTM_CSC_MSA;

        FTM0_C1SC &= ~FTM_CSC_ELSB;

        FTM0_C1SC |= FTM_CSC_ELSA;

        

 

 

        FTM0_MODE |= FTM_MODE_FTMEN;

        FTM0_SC |= FTM_SC_CLKS_SYS ;

        FTM0_SC |= FTM_SC_PS_1;

 

        if(isrControl == 0)

        fnEnterInterrupt(irq_FTM0_ID,

PRIORITY_HW_TIMER , ftm0_isr_nyt);

        

}

 

are you having any idee.

Iam working on a TWR-K60F120M

 

Outcomes