AnsweredAssumed Answered

[MCF51JM128] Falling edge or rising edge on Input Capture

Question asked by Pogo Lin on Nov 15, 2012
Latest reply on Dec 18, 2012 by TomE

Hi all,

I need to capture the falling edge and rising edge on input signal. I encountered one problem. That is when interrupt coming how do I recognized the coming event is rising edge event or falling edge event?

My thought is using the status of pin to determine which event is coming. The following code is my test.

... //Intial input capture     TPM1SC   = 0x0C;//CLKS = 01 : Bus rate clock - 24MHz, PS:100 : Divided-by 16. Timer clock : 1.5MHz     TPM1C2SC = 0x4C; //Input Capture on rising edge or falling edge   ... interrupt VectorNumber_Vtpm1ch2 void inputcapture_tpm1ch2(void) {     //clear flag     TPM1C2SC_CH2F = 0;     if( PTFD_PTFD2 )     {           //rising edge     }     else     {           //falling edge     } }  


But the result is always falling edge. Could any one give me any hint or suggestion?