stop the incrementing or stop the interrupt when freq >= maxfreq