Hi All,
I'm trying to understand how to activate the FTM3 overflow Interrupt handlers on the Kinetis K64 microcontroller. I'm able to generate the waveforms for both channels 4 and 5 of the FTM3. Everywhere i read it keeps saying i need to add my interrupt handler function name to the "kinetis_sysinit.c" file, located in the startup folder. However, i'm unable to locate such a file anywhere. The closest files i came across that mentioned about interrupt handlers are either vector.c or vector.h. Below is my test codes on the overflow, but it failed mto work. I'm using KDS IDE for this development.
void FTM3_IRQHandler()
{
if (FTM3_SC & FTM_SC_TOF_MASK){
FTM3_SC&=0x7F;
timer_overflow = 0x01;
pulses_cnt +=1;
}
}
byte pulse_motor(void)
{
static word count_pulse = 0x00;
static pulse_motors pulse_state = INIT_PULSE_DATA;
switch (pulse_state)
{
case INIT_PULSE_DATA:
#if 1
SIM_SCGC3|=0x2000000;
FTM3_CONF=0xC0;
FTM3_FMS=0x00;
FTM3_MODE|=0x05;
FTM3_MOD=1000;
FTM3_C4SC=0x68;
FTM3_C5SC=0x28;
FTM3_C4V=500;
#endif
FTM3_C5V=100;
FTM3_CNTIN=0x00;
FTM3_SC=0x08;
pulse_state = EXECUTE_PULSE_DATA;
break;
case EXECUTE_PULSE_DATA:
#if 1
if (pulses_cnt ==500){
pulses_cnt = 0x00;
FTM3_C5V=100;
}
#endif
break;
case PULSE_MOTOR_DONE:
pulse_state= INIT_PULSE_DATA;
break;
}
}
Could anyone point me to where i'm doing this wrong ?
Thanks,
Vu