A scanning probe microscope for oscillating a cantilever and performing relative scanning between said cantilever and a sample, comprising: exciting means for exciting said cantilever; a sensor for detecting displacement of said cantilever and generating a cantilever displacement signal; reference wave generating means for generating a reference wave signal that has a frequency based on an excitation signal of said cantilever and is of fixed phase difference with respect to said excitation signal; an oscillator having a plurality of channels, which generates said excitation signal of said exciting means and which generates said reference wave signal as said reference wave generating means, trigger pulse generating means for generating a trigger pulse signal whose pulse position changes dependent on the phase of oscillation of said cantilever, on the basis of the cantilever displacement signal from said sensor; and phase signal generating means for generating a signal dependent on the magnitude of said reference wave signal at said pulse position as a phase signal of said cantilever oscillation, on the basis of said reference wave signal and said trigger pulse signal, wherein said phase signal generating means includes a sample-hold circuit that holds said reference wave signal using said trigger pulse signal as sampling timing; and said trigger pulse generating means includes: a bandpass filter for extracting an oscillation waveform signal of excitation frequency component of the cantilever from the cantilever displacement signal; a phase shifter for shifting the phase of the oscillation waveform signal; a comparator for converting said oscillation waveform signal to a rectangular wave signal; and a differentiator for generating a pulse signal at the rectangular wave generation timing from said rectangular wave signal. exciting means for exciting said cantilever; a sensor for detecting displacement of said cantilever and generating a cantilever displacement signal; reference wave generating means for generating a reference wave signal that has a frequency based on an excitation signal of said cantilever and is of fixed phase difference with respect to said excitation signal; an oscillator having a plurality of channels, which generates said excitation signal of said exciting means and which generates said reference wave signal as said reference wave generating means, trigger pulse generating means for generating a trigger pulse signal whose pulse position changes dependent on the phase of oscillation of said cantilever, on the basis of the cantilever displacement signal from said sensor; and phase signal generating means for generating a signal dependent on the magnitude of said reference wave signal at said pulse position as a phase signal of said cantilever oscillation, on the basis of said reference wave signal and said trigger pulse signal, wherein said phase signal generating means includes a sample-hold circuit that holds said reference wave signal using said trigger pulse signal as sampling timing; and said trigger pulse generating means includes: a bandpass filter for extracting an oscillation waveform signal of excitation frequency component of the cantilever from the cantilever displacement signal; a phase shifter for shifting the phase of the oscillation waveform signal; a comparator for converting said oscillation waveform signal to a rectangular wave signal; and a differentiator for generating a pulse signal at the rectangular wave generation timing from said rectangular wave signal. a bandpass filter for extracting an oscillation waveform signal of excitation frequency component of the cantilever from the cantilever displacement signal; a phase shifter for shifting the phase of the oscillation waveform signal; a comparator for converting said oscillation waveform signal to a rectangular wave signal; and a differentiator for generating a pulse signal at the rectangular wave generation timing from said rectangular wave signal.