AnsweredAssumed Answered

Capture frequency_KEAZN16_prcoessor expert

Question asked by Vijeendra N on Jan 21, 2016
Latest reply on Jan 21, 2016 by Robin_Shen

for(;;)

  {

   if ((Cap1_GetEventStatus(CapPtr) & LDD_CAPTURE_ON_CAPTURE)!=0U)

     {

       Error = Cap1_GetCaptureValue(CapPtr, &Data);

       current_data = Data;

      

            

       if (current_data > previous_data)

         result = current_data - previous_data;

         previous_data = current_data;

        res_ppg = (result / 6.427977839)*3.814697266;

      

       PPG1_SetRatio16(CapPtr,32767);

      PPG1_SetPeriodUS(CapPtr,res_ppg);

     }

  }

The above code is working fine, Issue is

if there is no input, then res_ppg will have the previous value.

I know - bcoz of  "if ((Cap1_GetEventStatus(CapPtr) & LDD_CAPTURE_ON_CAPTURE)!=0U)",

code doesn't enter into the loop and hence it shows previous freq value.

 

I tried by providing else loop, but its not working,

 

Any suggestions !

Outcomes