0

I have a simple Low pass filter in my program that stops working after some time (Let say 4 hours or more). 'CRate' is a double type variable between -20 and 100.

uint8_t T_Sample=10; 
double FCR0=100.0, CRate=0, FCR=0;

loop()
{
// CRate is calculated here

 double Tau = 0.001;
 double v = 1000.0 * Tau / T_Sample;  //  Tau/T

 FCR = 1/(v+1.0)*(FCR0 *v  + CRate);    //  Backward    

delay(5000);
}

If I set Tau with a bigger number (500), the loop stops immediately. However, with small values, it works for some hours and then stops. FCR start from FCR0=100 and filters CRate. Do I need to re-write the formula or change the variable to float or whatever else though the variables are within the limitation?

Thank a lot for any help!

  • Comments are not for extended discussion; this conversation has been moved to chat. – Majenko Feb 24 '19 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.