A scanning probe microscope has a cantilever having a minute probe on a
distal end thereof and a displacement detecting device for detecting
displacement of the cantilever. A Z-axis controlling amount calculating
mechanism calculates a controlling amount for keeping constant a
displacement amount of the cantilever. A Z-axis driving mechanism drives
in a Z direction the cantilever or a sample in accordance with the
controlling amount from the Z-axis controlling amount calculating
mechanism. An XY scanning mechanism relatively moves the probe in a
direction of an XY plane with respect to the sample to measure an uneven
shape and/or a physical characteristic of the surface of the sample. A
controlling range limiting device limits a driving range of the Z-axis
driving mechanism. A controlling range setting device optionally sets the
driving range of the Z-axis driving mechanism.