With counter for counting switching on digital inputs