Thanks for the ESP info. I may end up using that.
In the meantime, I cobbled up a hardware up counter using MC14520. As I suspected the hardware glitch was due to using two independent clocks that were not synchronised. Because the interval could catch a clock pulse on the rising or falling edge, or anywhere in between, my hardware counter with an interval of seven pulses would count seven pulses three times successively, then eight pulses three times successively, then back to seven pulses. Good enough for now, I know what to look for later. I'm more inclined to implement as much in hardware as I can and not worry about interrupts and delays. THANKS for all the help.