AnsweredAssumed Answered

Fex timer sample code

Question asked by punith B on Sep 26, 2015
Latest reply on Sep 29, 2015 by punith B

HI All,


I am using SKEAZN64MLC controller in my project,

Now i need to implement some timer logic for my requirement.

I need to keep on count the timer count value, once counter value greater than some predefined value , then i need to stop timer.

and again start the timer by count value initializing to 0.


1. How to start and stop flex timer?.

2. How to initialize the timer to count for 1 us.?.

void FTM_Init()


      SIM->SCGC |= SIM_SCGC_FTM2_MASK; /* Enable Clock for FTM2 */

     FTM2->SC |= FTM_SC_PS(3);

       FTM2->SC |= FTM_SC_CLKS(3); /*FTM2 use system clock*/

// external clock is 8MHZ so 8/2^3=1mhz so timer increment for each 1 us.


is this correct?.

3. is timer count will automatically update to FTM2->CNT or need to capture every time?.

Basically i need to set of sample codes for flex timers , kindly share to me.