bitSet(TCCR1B, CS12); // start counting pulses
bitSet(TCCR1B, CS11); // Clock on rising edge
FYI, that is counting on a falling edge. If you want to count on rising edge, do this instead
TCCR1B = 1<<CS12 | 1<<CS11 | 1<<CS10
You want to set TCCR1B in a single statement as doing the following
bitSet(TCCR1B, CS12)
Would start the timer at 62500 Hz immediately
Just replace these two statements
bitSet(TCCR1B, CS12); // start counting pulses
bitSet(TCCR1B, CS11); // Clock on rising edge
with
TCCR1B = 1<<CS12 | 1<<CS11 | 1<<CS10