This made me thinking:
ch1 = pulseIn(7, HIGH, 25000);
ch2 = pulseIn(6, HIGH, 25000);
How often do the pulses come in? If I understand corectly, the program halts for measuring the pin 7 pulse. If no pulse for 25 ms, it returns zero and continues to tmeasuring the pulse at pin 6, halting again. Maybe you can deal with the waiting, but there's still some waiting going on. Could it cause the problems you are facing? If I'd write those routines from scratch, I'd use millis() or micros() and avoid the waiting.