accurate counting of pulses