FreqCountESP
FreqCountESP copied to clipboard
bouncing input signal hack
Hi Nikos, thank you for the code, works well with proper edges, e.g. from function generator.
I use your module for RPM measurement on my CNC DC-spindle. I added a line-follower-module for RPM measurement, which provides a pretty good, but not perfect rectangle edge.
Bouncing I suppressed with 0.1 nF capacitor at input, and the following code hack in your module.
Any better / alternative idea ?
Greetings from Wolf Ludwig, [email protected] :-)
void IRAM_ATTR onRise() { portENTER_CRITICAL_ISR(&_FreqCountESP::sMux); if(digitalRead(FreqCountESP.mPin)){ _FreqCountESP::sCount++; } portEXIT_CRITICAL_ISR(&_FreqCountESP::sMux); }