Add global speed control to custom routine for easier use between different clock speeds.