1. An all-digital controller for a microscope, comprising: a digital frequency, amplitude, and phase estimator for estimating phase, frequency, and amplitude of an input signal, from which small frequency shifts that translate to small shifts in a cantilever spring constant in said microscope are determined, said digital frequency, amplitude, and phase estimator providing a base signal for driving said cantilever and effecting cantilever position control thereof as an output; an algorithm, embodied on a computer readable medium, for combining estimation of the frequency, phase, and amplitude of said input signal into a single estimation scheme; a digital amplitude controller for receiving an estimated amplitude component of said input signal from said estimator and a reference amplitude signal as an input and providing a compensated amplitude for said base signal as an output; a digital phase shifter for receiving an estimated phase component of said input signal from said phase estimator and a phase offset signal as an input and providing a phase compensated signal as an output; and a digital oscillator, said oscillator receiving as an input said amplitude controller output and said digital phase shifter output and producing a base signal for driving said cantilever that oscillates the cantilever at or near its resonance frequency.