Dao Yan Lim

How to update FTM_MOD in interrupt, and FTM1_CnV and FTM2CnV?

Discussion created by Dao Yan Lim on Jul 10, 2016
Latest reply on Jul 11, 2016 by Dao Yan Lim

Hi,

 

I am using TWR-K60N512, with PK60DN512Z VMD10 chip. I have no problem updating FTMn_MOD in the main code with a short delay, but I couldn't update it smoothly in an interrupt.

 

I have multiple interrupt functions, one for a switch, another for a potentiometer, and the last one for FTM. If I were to update FTMn_MOD in the interrupt function, nothing changes unless I hit the switch. Can't seem to figure out what the problem is.

 

Another question I have is how to update the channel values of different modules specifically FTM1_CnV and FTM2_CnV. I tried it with and without interrupt but nothing seems to be changing. I have no problem updating FTM1_MOD and FTM2_MOD without using interrupt. I also have no problem updating the channel values of FTM0.

 

Any idea how I can troubleshoot the two problems that I have? I have attached my code.

 

Thanks.

Original Attachment has been moved to: PWM.c.zip

Original Attachment has been moved to: pwm_demo.c.zip

Outcomes