Remove glitch from inductive load

Hello,

I try to count the correct duration of an injection time of my motorbike on an stm32 board.

you can see the glitch on the original signal and the other screen is the signal view by the arduino.

I whant to remove the glitch seen by the board.
Do you know some code who can help me ?

i use interruptions

void falling() {
  prev_time = micros(); 
  digitalWrite (PA10, LOW); // to see the high level on an output of the board... just for test
}

void rising() {
   dureeInj = (micros() - prev_time);  
   CumulInjTrip =  CumulInjTrip + dureeInj; 
   digitalWrite (PA10, HIGH);
}

thanks for your help :wink:

ps : excuse me for my poor english.

I don't think code can "remove" a glitch it did not create. Are you asking if code can ignore the glitch? then possibly. I assume you know the source of the glitch and cannot remove it at it's source.

You can count the number of "risings" and only process on the second.

Paul

Paul_KD7HB:
I don’t think code can “remove” a glitch it did not create. Are you asking if code can ignore the glitch? then possibly. I assume you know the source of the glitch and cannot remove it at it’s source.

You can count the number of “risings” and only process on the second.

Paul

Thanks for your answer Paul.
I whant to ignore the glitch. I know the source of this glitch and i can’t remove it.

The information processing can be offset from the time I get to count all pulses in the end on a tank of gas.

This is like deboucing a switch - unless the signal persists in a new state for a set number of microseconds,
treat it as a glitch.

Warning, when you select the images the linked website can lock up your iPad

.