Clock for microprocessor synchronized with pulses from encoder