Patent ID: 8731125

Claim:
A method for aligning the phases of a master clock and a slave clock, comprising the following steps: A: locking a phase of the master clock; B: measuring phase difference between the slave clock and the master clock; and C: adjusting, based on the phase difference measured in Step B, a phase outputted by the slave clock so as to align the phase outputted by the slave clock with the phase of the master clock, wherein in the Step B, a phase of the slave clock is shifted, and when the phase of the slave clock after the phase shift and the phase of the master clock are aligned, the shifted phase is outputted as the phase difference value, wherein the Step B comprises the following operations: B1: shifting the phase of the slave clock with a predetermined step length along a predetermined direction; B2: sampling the master clock by using the slave clock after the phase shift; B3: judging, based on the sampling result of Step B2 whether the phase of the slave clock after the phase shift and the phase of the master clock are aligned, wherein if the phase of the slave clock and the phase of the master clock have been aligned, Step B5 is performed and if the phase of the slave clock and the phase of the master clock have not been aligned, Step B4 is performed; B4: judging whether a threshold of the phase shift is reached, wherein if the threshold of the phase shift is not reached, Step B1 is performed; and if the phase difference is not obtained when the threshold of the phase shift is reached, the measurement is ended, and the Step C further comprises ending this operation when the phase difference is not obtained; and B5: calculating the phase difference between the master clock and the slave clock according to the number of the phase shifts of the slave clock.