Abstract:
An All-in-one Digital Cantilever Controller applicable to all SFM systems is disclosed that can perform many relevant experiments for cantilever control in Scanned Force Microscopy. It is comparable in speed to analog components, especially when performing experiments that must resolve the smallest possible frequency shift. It is compact in the sense that one optimized digital implementation replaces analog components associated with cantilever signal processing and control. It has minimal thermal drift, at least an order of magnitude less than analog components. It has a number of meaningful tuning parameters available, as well as a user-friendly graphical interface (GUI) for adjusting those tuning parameters and performing different types of experiments. The disclosed invention also provides an optimal strategy for maximizing algorithm execution speed, while maintaining desired algorithm accuracy.

Description:
BACKGROUND OF THE INVENTION 
       [0001]    1. Technical Field 
         [0002]    The invention relates to scanning probe microscopes, such as atomic force microscopes or magnetic resonance force microscopes. More particularly, the invention relates to control systems used for operating a scanning probe microscope. 
         [0003]    2. Description of the Prior Art 
         [0004]    Since the invention of the scanning tunneling microscope (STM), a variety of other scanning probe microscopes have been developed. Among these, scanning force microscopy (SFM) is the most prominent technique. In SFM, interaction forces acting between a scanned probe tip and a sample are exploited for imaging purposes, similar to the tunneling current in STM. Examples of SFM are atomic force microscopy (AFM), electric force microscopy (EFM), and magnetic resonance force microscopy (MRFM). 
         [0005]    The key component in SFM is a tip on a cantilever, which acts as a force sensor. See, e.g. Marohn et al. (1998), Garner et al. (2004), and Struckmeier et al. (2006). When the tip is brought close to the surface of the sample under investigation, the interaction force between the tip and the sample causes a deflection of the cantilever, which behaves as a soft spring. It can be shown that the force gradients acting on the cantilever, in effect, change the cantilever&#39;s spring constant, and hence its resonance frequency. See, e.g. Albrecht et al. (1991) and Dürig et al. (1997). By measuring this change in resonance frequency of the cantilever, the interaction force can be measured. 
         [0006]    There are several different ways to determine changes in the resonance frequency. One such method is slope detection, where the cantilever is driven off resonance and a change in the resonance frequency is registered as a change in the amplitude of the cantilever response. Another method is phase detection, where the cantilever is driven at resonance, and a change in the resonant frequency is recorded as a change in the phase of the response. Yet another method uses the cantilever as a frequency-determining element in a positive feedback loop. See Albrecht et al. (1991) for a comparison of these methods. The voltage in the loop is demodulated to give the frequency of the cantilever. The frequency-modulation (FM) approach has the advantage of following cantilever frequency shifts which are large compared to the natural width of the cantilever resonance. Another advantage is that its bandwidth is governed only by the characteristics of the FM demodulator. 
         [0007]    As with many imaging applications, the more sensitive the measuring apparatus is, the more accuracy it can measure, and the better the quality of its image. This is definitely true for scanned-force microscopy (SFM): the better it can measure the interaction force, or the higher the force sensitivity, the better the quality of its image. This better image quality typically translates to the ability to measure smaller features of the sample one is imaging, i.e. a higher resolution. In SFM, the mechanical properties of the cantilever, which are determined by its dimensions and material properties, ultimately define the sensitivity of the measurement system. However, for a cantilever of given dimensions and material, control of the cantilever motion is instrumental in extracting the best possible information from the measurement system. 
         [0008]    Control of a cantilever involves three key components: 
         [0009]    1. A sensor to detect the motion of the cantilever, e.g. an optical interferometer that detects the position of the cantilever tip as a function of time; 
         [0010]    2. A mechanism to force-actuate the motion of the cantilever, e.g. a piezo element that exerts a force at the base of the cantilever; and 
         [0011]    3. An algorithm that computes the force actuation based on the sensor measurements. This algorithm can be a combination of different control loops. 
         [0012]    Typically, different parts of the algorithm are exercised for different types of experiments one wishes to perform with the cantilever. Typical control experiments include (but are not limited to):
       Excitation of the cantilever via positive feedback control while locking to the cantilever resonance frequency. This experiment measures the cantilever frequency and shifts in the resonant frequency, which are used for imaging surface topology.   Optimal feedback control of the cantilever that attenuates the thermo-mechanical fluctuations from the observed cantilever motion to minimize vibration of the cantilever tip.   Ring-down measurements and observation of thermal fluctuations to calculate the mechanical properties of the cantilever, such as quality factor, resonance frequency, and spring constant.   Amplitude control of the cantilever tip position, i.e. maintaining a constant amplitude of the observed cantilever motion in the face of frequency changes and/or thermal fluctuations.   Frequency-shift control of the cantilever tip position, i.e. maintaining a constant frequency-shift of the observed cantilever motion by changing the distance, e.g. height, between the cantilever and the sample.       
 
         [0018]    Currently, the preferred method of implementation of these control experiments is the use of analog components, mainly because analog components are inexpensive and fast. However, there are a number of disadvantages to the use of analog components:
       Each time the mechanical properties of the cantilever change significantly, such as its resonance frequency, some of the analog components must be replaced to maintain stability and performance.   Similarly, tuning of control experiments requires either adjusting potentiometers or replacing analog components. Besides the tedium and required skill of doing this, there is also a level of uncertainty involved in the final implementation.   Analog components suffer from thermal drift as the ambient temperature changes during an experiment. This can influence the outcome of an experiment if the experiment is performed over a long period of time. This is especially crucial when imaging, which typically takes a long time. That is, points in the image taken at a later time could be distorted by thermal drift with respect to points taken at the beginning of the image.   Each of the experiments described above requires a different set of analog components and, thus, the work rack fills up quickly with all the different components, breadboards, and other equipment used for the experiment.       
 
         [0023]    Given these disadvantages, it is no surprise that some people started looking into a digital alternative, i.e. the use of a digital circuit such as a Digital Signal Processor (DSP) or Field Programmable Gate Array (FPGA) for implementing at least some of the abovementioned control experiments. One such an example is the work of Loppacher et al. (1998) who implemented a Phase-Lock-Loop (PLL) with a digitally synthesized clock, and which was able to resolve a small 5 MHz change in a 280 kHz sinusoid with a PLL bandwidth of 500 Hz. Another example is the use of GNU radio, which uses a combination of FPGA and DSP to implement the Optimal Control experiment. A sampling rate of roughly 250 kHz is achieved with 16 bit accuracy, see J. Jacky et al. (2006). Also, there are a number of commercial circuits available, such as frequency counters, lock-in amplifiers, and digital PLL&#39;s, which can be used in some of the abovementioned experiments. 
         [0024]    The ideal digital controller would be able to do all of the experiments described above and more. It would be comparable in speed to analog components, especially when it comes to experiments that resolve the smallest possible frequency shift. It would be compact in a sense that one small circuit would replace all of the analog components, as well as other units such as lock-in amplifiers, frequency counters, etc., basically providing one box that would replace an entire rack of components. It would have minimal thermal drift, at least an order of magnitude less than analog components. It would have a number of meaningful tuning parameters available, as well as a user-friendly graphical interface (GUI) for adjusting those tuning parameters and performing different types of experiments. Neither the described digital implementations in the literature, nor any of the commercially available digital circuits can meet all of these requirements. 
         [0025]    It would be advantageous to provide an approach and implementation that addresses all of these limitations. 
       SUMMARY OF THE INVENTION 
       [0026]    The presently preferred embodiment of the invention, which provides an approach and implementation that addresses all of the above noted limitations of the state of the art, is referred to herein as an All-in-one Digital Cantilever Controller, or simply an All-Digital Cantilever Controller. One key observation is the fact that execution speed of any digital algorithm has to be traded-off against bit accuracy of the algorithm variables, i.e. the more accurate the algorithm, the slower it executes. In addition to being an all-in-one digital algorithm, the disclosed invention also provides an optimal strategy for maximizing algorithm execution speed, whilst maintaining desired algorithm accuracy. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0027]      FIG. 1  is a schematic diagram of a typical scanned force microscope acting as a force sensor in a (digitally) controlled loop according to the invention; 
           [0028]      FIG. 2  is a schematic diagram of a digital circuit controlling a scanned force microscope according to the invention; 
           [0029]      FIG. 3  is a block schematic diagram of a pre-processing unit according to the invention; 
           [0030]      FIG. 4  is a block schematic diagram of a Phase-Locked Loop (PLL) according to the invention; 
           [0031]      FIG. 5  is a block schematic diagram of a Lock-In Amplifier according to the invention; 
           [0032]      FIG. 6  is a schematic diagram of an Adjustable Phase Shifter according to the invention; 
           [0033]      FIG. 7  is a block schematic diagram of an Amplitude Controller according to the invention; and 
           [0034]      FIG. 8  is a block schematic diagram of a post-processing unit according to the invention. 
       
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
       [0035]    Digital Cantilever Control 
         [0036]    A recent development in cantilever motion control for Scanning Force Microscopy is the use of digital circuits, such as a Digital Signal Processor (DSP), or Field Programmable Gate Array (FPGA), or a combination thereof. Digital control systems are becoming increasingly more common. Among the advantages of digital controllers are increased flexibility and the complex logic capability of digital systems that are combined with the dynamic control function to meet stringent closed-loop performance specifications. Another advantage is that one hardware platform can be used with many different software variations, leading to the efficient development of a broad range of products. See Franklin et al. (1998). Specifically, two main advantages of digital circuits over analog circuits for cantilever motion control are:
       Tunability for different cantilevers and different experiments: Changing algorithms and parameters is very easy to do in a digital circuit using software. In an analog circuit, this typically requires swapping hardware components.   Small thermal drift: Dependent on their clock, digital circuits can have very low thermal drift, oftentimes orders of magnitude lower than analog circuits. This is especially beneficial when performing imaging experiments over a long period of time.       
 
         [0039]    Besides these two advantages, digital circuits also have the advantage of being compact, replacing many analog components with one single circuit board. 
         [0040]      FIG. 1  is a schematic diagram of a typical scanned force microscope acting as a force sensor in a (digitally) controlled loop according to the invention.  FIG. 2  shows a schematic of the digital circuit for controlling the scanned force microscope of  FIG. 1 . 
         [0041]    In  FIG. 2 , the following legend applies: 
         [0042]    Legend 
         [0043]    A 0  amplitude of incoming analog signal 
         [0044]    A 1  amplitude of incoming sampled signal after scaling 
         [0045]    A 2  actual amplitude of outgoing (driving) signal 
         [0046]    Â 1  estimate of amplitude of incoming sampled signal 
         [0047]    Â 2  calculated amplitude of outgoing (driving) signal 
         [0048]    {dot over (A)} ref  amplitude reference value 
         [0049]    φ 0 (t) time-dependent phase of incoming analog signal at time t 
         [0050]    φ 1 (t k ) time-dependent phase of incoming sampled signal at sampled-time t k    
         [0051]    φ 2 (t) time-dependent phase of outgoing analog (driving) signal at time t 
         [0052]    φ offs  user-programmable phase offset 
         [0053]    {circumflex over (φ)} 1 (t k ) estimate of phase of incoming sampled signal at sampled time t k    
         [0054]    {circumflex over (φ)} 2 (t k ) adjusted phase of outgoing sampled signal at sampled time t k    
         [0055]    {circumflex over (ω)} 0  estimate of cantilever natural frequency 
         [0056]    Digital control of a cantilever involves three key components: 
         [0057]    1. A sensor to detect the motion of the cantilever, e.g. an optical interferometer that detects the position of the cantilever tip as a function of time; 
         [0058]    2. A transducer to force-actuate the motion of the cantilever, e.g. a piezo element that exerts a force at the base of the cantilever; and 
         [0059]    3. A digital circuit for executing an algorithm that computes the force actuation, based on the sensor measurements. 
         [0060]    The presently preferred embodiment of the invention concerns the design and implementation of this third component: a software algorithm executed by this digital circuit. This algorithm can be a combination of different control loops. Typically, different parts of the algorithm are exercised for different types of experiments one wishes to perform with the cantilever. Typical control experiments include, but are not limited to:
       Excitation of the cantilever via positive feedback control while locking to the cantilever resonance frequency.   Optimal feedback control of the cantilever to attenuate thermo-mechanical fluctuations.   Ring-down measurements and observation of thermal fluctuations.   Amplitude control of the cantilever tip position.   Frequency-shift control of the cantilever tip position.       
 
         [0066]    To understand the nature of the control tasks of the digital algorithm, and the design aspects involved, one first needs to describe the cantilever dynamics and the control problem involved. 
         [0067]    Cantilever Dynamics 
         [0068]    Let the cantilever be represented by a simple harmonic oscillator with mass m and spring constant k, and dissipative damping d. Its equation of motion under influence of a driving force f is given by: 
         [0000]        m{umlaut over (x)}+d{dot over (x)}+kx=f,    (1) 
         [0069]    yielding a resonance frequency ω 0    
         [0000]    
       
         
           
             
               
                 
                   
                     ω 
                     0 
                   
                   = 
                   
                     
                       
                         k 
                         m 
                       
                     
                     . 
                   
                 
               
               
                 
                   ( 
                   2 
                   ) 
                 
               
             
           
         
       
     
         [0070]    Define the dissipation factor Q as 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       Q 
                        
                       
                           
                       
                        
                       • 
                        
                       
                         
                           
                             k 
                              
                             
                                 
                             
                              
                             m 
                           
                           
                             d 
                             2 
                           
                         
                       
                     
                     = 
                     
                       
                         
                           ω 
                           0 
                         
                          
                         m 
                       
                       d 
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   3 
                   ) 
                 
               
             
           
         
       
     
         [0071]    then we can rewrite (1) in its more standard form: 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       x 
                       ¨ 
                     
                     + 
                     
                       
                         
                           ω 
                           0 
                         
                         Q 
                       
                        
                       
                         x 
                         . 
                       
                     
                     + 
                     
                       
                         ω 
                         0 
                         2 
                       
                        
                       x 
                     
                   
                   = 
                   
                     
                       
                         f 
                          
                         
                             
                         
                          
                         
                           ω 
                           0 
                           2 
                         
                       
                       k 
                     
                     . 
                   
                 
               
               
                 
                   ( 
                   4 
                   ) 
                 
               
             
           
         
       
     
         [0072]    The cantilever is coupled to the sample under investigation via the tip-sample interaction. This coupling can be described by an additional spring force f s =k s x whose spring constant k s  is equal to the gradient of the tip-sample force. Using Equation (2), we see that this spring force changes the resonance frequency of the cantilever to: 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       ω 
                       ~ 
                     
                     0 
                   
                   = 
                   
                     
                       
                         
                           k 
                           + 
                           
                             k 
                             s 
                           
                         
                         m 
                       
                     
                     = 
                     
                       
                         ω 
                         0 
                       
                        
                       
                         
                           
                             1 
                             + 
                             
                               
                                 k 
                                 s 
                               
                               k 
                             
                           
                         
                         . 
                       
                     
                   
                 
               
               
                 
                   ( 
                   5 
                   ) 
                 
               
             
           
         
       
     
         [0073]    Therefore, if the cantilever is vibrating in equilibrium around its resonance frequency, the interaction force gradients can be determined by measuring shifts in the resonance frequency of the cantilever using Equation (5). 
         [0074]    Frequency Shift Detection 
         [0075]    One of the simplest methods to measure frequency shifts is to excite the cantilever at a fixed frequency close to resonance and to measure its response using a lock-in technique. As already explained, a much more favorable technique is to use the cantilever as a resonator in an active feedback loop, and use frequency modulation (FM) to determine the frequency shift, as first introduced by Albrecht et al. (1991). The two main advantages of this method are:
       Force gradients, such as k s , can be unambiguously distinguished from dissipative, i.e. Q-related, interactions from a phase-frequency measurement.   The vibration amplitude of the cantilever is controlled by a feedback loop that is capable of exciting and damping the oscillations.       
 
         [0078]      FIG. 2  shows a block schematic diagram of a (digital) controller hardware and software  20  according to the invention. This controller has at least five distinct components:
       1. a pre-processing unit  21 ;   2. a frequency, amplitude, and phase detector  22 ;   3. a phase shifter  23 ;   4. an amplitude controller  24 ; and   5. a post-processing unit  25 .         
         [0084]    Pre-Processing Unit ( 21 ) 
         [0085]    The pre-processing unit  21  consists of signal pre-processing software and/or hardware, as well as an Analog-to-Digital (A/D) converter  33 , see  FIG. 3 . Among other things, the pre-processing unit  21  removes any DC component from the raw incoming signal via AC coupling  31 . Furthermore, it scales the incoming signal to a range that maximizes use of the available number of bits in the A/D converter  32 . If, for example, the A/D converter quantizes the analog signal using sixteen bits, one wants to make sure that the amplitude of the incoming signal is such that it corresponds to a bit close to the Most-Significant Bit (MSB), so that (nearly) all sixteen bits are used to quantize the signal, and not just the least significant bits. Next, the signal is either converted to the digital domain using the A/D converter  33  and then filtered by a noise filter  34 , or the signal is first filtered and then converted to the digital domain. The filtering is used to reduce the effect of noise on the incoming signal, and the A/D conversion is necessary to process the signal further in a digital processor. 
         [0086]    Frequency, Amplitude, Phase Detector ( 22 ) 
         [0087]    The frequency, amplitude and phase detector  22  is an important and essential part of the controller. It estimates the phase, frequency, and amplitude of the incoming signal, from which the small frequency shifts that translate to small shifts in cantilever spring constant are determined. It also provides the base signal for driving the cantilever. The amplitude estimation part is used for amplitude control. 
         [0088]    A common and established way of estimating the phase and frequency of the incoming signal is by using a Phase-Locked Loop  40  (PLL), see  FIG. 4 . A PLL consists of a phase comparator  41 , a feedback amplifier  42 , and a Voltage-Controlled Oscillator (VCO)  43 . A PLL circuit keeps the phase between the cantilever and the VCO  43  locked by feeding back the phase difference between the cantilever oscillation and the reference oscillator to make them both the same. In the locked-in state, the VCO signal represents a mirror image of the frequency component contained in the cantilever signal. A big advantage of a PLL over other phase/frequency detection schemes, such as a frequency counter, is the fact that it works very well with low signal-to-noise ratios, i.e. noisy signals, and the fact that it serves as both an excitation signal for the cantilever, as well as an accurate frequency detector. 
         [0089]    For amplitude detection, typically a so-called lock-in amplifier  50  is used, see  FIG. 5 . The incoming cantilever signal may be amplified by an input amplifier  51 , especially when its signal strength is low, and then filtered through a band-pass filter  52  to extract only the frequency content of interest. The lock-in amplifier is supplied with a reference signal at a frequency derived from the same source as the cantilever signal, e.g. the output of the VCO  43 . This reference signal is then shifted in phase using a phase shifter  53 . The detection process now consists of multiplying these two signals together in a mixer  54 , referred to herein as a Phase-Sensitive Detector (PSD). It can be shown that for a sinusoidal input signal and sinusoidal reference signal of the same frequency, the output signal of the mixer contains a DC component that provides an estimate of the amplitude of the cantilever input signal, as well as a sinusoidal component at twice the frequency of the input signal. If this output is filtered with a low-pass filter  55 , the higher frequency component is removed, and what remains is the DC component. Finally, an output amplifier  56  scales the final output signal to provide a correct estimate of the actual amplitude of the input signal. 
         [0090]    The presently preferred embodiment of the invention uses an algorithm that combines the estimation of the frequency, phase, and amplitude of the incoming signal into a single integrated estimation scheme. Therefore, the need for PLL goes away. Combined frequency, phase, and amplitude estimation of periodic signals in the continuous, i.e. analog, domain is taught by B. Wu and M. Bodson (2001). 
         [0091]    Adjustable Phase Shifter ( 23 ), ( 53 ) 
         [0092]    The phase shifter  23 , and also  53 , allows one to adjust the proper operating conditions for the oscillating cantilever. To generate a driving signal that sustains oscillations of the cantilever, the driving signal must be 90° out of phase with the measured position signal, which can be derived from Equation (1). In addition, the hardware and/or software inhibits a delay from, e.g. A/D and D/A converters, and dynamic filters. The adjustable phase shifter can compensate for this so that the driving signal is perfectly out of phase with the incoming cantilever signal, see  FIG. 6 . The phase of the incoming signal is modulated by a value φ offs  that includes the 90° out of phase compensation, plus the compensation for hardware and/or software phase delay. 
         [0093]    Amplitude Controller ( 24 ) 
         [0094]    The amplitude controller  24  consists of a standard Proportional-Integral (PI) controller algorithm. See, e.g. Franklin et al. ( 2006 ). This controller takes as an input the estimated amplitude Â 1  from the detector  22 , as well as a user-programmable reference amplitude A ref , and sends the difference between the two to an integrator  71 , see  FIG. 7 . The controller calculates the amplitude of the driving signal, such that the estimated amplitude of the cantilever oscillation is equal to the desired reference amplitude. The integral gain K I    72  and proportional gain K P    73  of the algorithm are chosen, such that this feedback loop is stable and short term amplitude fluctuations are damped out. The gain of the controller can assume both positive and negative values, corresponding to excitation and damping of the cantilever oscillations, respectively. The appropriate gain value to use depends on the type of experiment one wants to perform, as explained earlier. In addition, the amplitude of the driving signal can be held constant, e.g. when performing a frequency-shift feedback experiment. The amplitude of the driving signal calculated by this controller is also a relative measure for the Q factor of the cantilever and, therefore, made available to the user. 
         [0095]    Post-Processing Unit ( 25 ) 
         [0096]    The post-processing unit  25  consists of any post-processing software and/or hardware, as well as a Digital-to-Analog (D/A) converter  83 , see  FIG. 8 . Among other things, the post-processing unit  25  adds a DC component  81  back to the signal. Furthermore, because the D/A converter usually runs at a much higher sampling rate than the sampling rate at which the driving signal is being updated, the driving signal is held by a hold algorithm  82 . The most common hold algorithms are zero-order and first-order hold, but higher order hold algorithms are not excluded. Next, the held signal is converted to the analog domain using a D/A converter  83 . The analog signal coming out of the D/A converter can then be scaled to a signal acceptable for the cantilever actuator using gain scaling  84 . 
         [0097]    All-in-One Algorithm 
         [0098]    A unique aspect of the presently preferred embodiment of the invention is the fact that it combines all of the above-described components into a single digital all-in-one algorithm, i.e. the invention constitutes a single digital algorithm that includes signal pre-processing  21 , combined frequency, amplitude, and phase detection  22 , adjustable phase shifting  23 , amplitude control  24 , and signal post-processing  25 . Not only does this all-in-one algorithm allow for extremely compact code and, therefore allow for maximizing speed of the overall algorithm, but it also provides increased flexibility because one hardware design can be used with many different software variations, and thus can be used for many different Scanned-Force Microscopy (SFM) systems. The software has many user-programmable parameters to configure and tailor it to user-specific experiments. Moreover, the elimination of analog components allows for performing nearly drift-free experiments, which is critical for SFM imaging. In addition, it allows for a very compact hardware design because many individual analog components are replaced by a single component that includes a digital processor together with A/D and D/A converters. 
         [0099]    Quantization for Digital Control 
         [0100]    Probably, the most intricate part of digital cantilever control is quantization of the control algorithm variables, See, Franklin et al. (1998). Although digital processors are available that can handle floating point variables, it is still true that faster algorithm speeds can be obtained with fixed point, i.e. integer, processors. To appreciate the complexity of quantization of an algorithm for a fixed-point processor, and the issues involved, a brief overview of fixed-point quantization is given. 
         [0101]    The presently preferred embodiment of the invention represents numbers by a so-called implied binary point representation, denoted as q[a,b], where a is the integer word-length (IWL) and b is the fractional word-length (FWL). Most variables in the invention are numbers that are signed, two&#39;s complement. The word-length (WL) or total number of bits, n, of a signed number q[a,b] is: 
         [0000]        n=a+b+ 1   (6) 
         [0102]    The value of a specific n-bit binary signed number q in a q[a,b] representation is given by the expression: 
         [0000]    
       
         
           
             
               
                 
                   
                     q 
                     = 
                     
                       
                         ( 
                         
                           1 
                           
                             2 
                             b 
                           
                         
                         ) 
                       
                        
                       
                         ( 
                         
                           
                             
                               - 
                               
                                 2 
                                 
                                   n 
                                   - 
                                   1 
                                 
                               
                             
                              
                             
                               w 
                               
                                 n 
                                 - 
                                 1 
                               
                             
                           
                           + 
                           
                             
                               ∑ 
                               
                                 i 
                                 = 
                                 0 
                               
                               
                                 n 
                                 - 
                                 2 
                               
                             
                              
                             
                               
                                 2 
                                 i 
                               
                                
                               
                                 w 
                                 i 
                               
                             
                           
                         
                         ) 
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   7 
                   ) 
                 
               
             
           
         
       
     
         [0103]    where w i  represents bit i of q. The range of q[a,b] is given by: 
         [0000]      −2 a   ≦q≦ 2 a −2 −b    (8) 
       EXAMPLE  
       [0104]    The signed number q[−3,18] has −3+18+1=16 bits and the range is from − 2   −3  to 2 −3 −2 −18  or −0.125 to 0.12499618530273. The value 856 Ch (1000,0101,0110,100b) is: 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       ( 
                       
                         1 
                         
                           2 
                           18 
                         
                       
                       ) 
                     
                      
                     
                       ( 
                       
                         
                           - 
                           
                             2 
                             15 
                           
                         
                         + 
                         
                           2 
                           2 
                         
                         + 
                         
                           2 
                           3 
                         
                         + 
                         
                           2 
                           5 
                         
                         + 
                         
                           2 
                           6 
                         
                         + 
                         
                           2 
                           8 
                         
                         + 
                         
                           2 
                           10 
                         
                       
                       ) 
                     
                   
                   = 
                   
                     
                       - 
                       31380 
                     
                     262144 
                   
                 
               
             
             
               
                 
                   = 
                   
                     - 
                     0.11970520019531 
                   
                 
               
             
           
         
       
     
         [0105]    Addition and subtraction 
         [0106]    Two signed numbers q1[a 1 ,b 1 ] and q2[a 2 ,b 2 ] can only be added or subtracted if a 1 =a 2 =a and b 1 =b 2 =b. If no knowledge of the physical range of the variables q1 and q2 is available, the result q3=q1+q2 should be represented by q3[a+1,b] to prevent overflow or have a carry out. However, in most cases encountered in the invention, the result was determined to be q3[a,b] without having overflow. 
         [0107]    Multiplication 
         [0108]    The (intermediate) result of multiplying two signed numbers q1[a 1 ,b 1 ] and q2[a 2 ,b 2 ] is a number with IWL equal to a 1 +a 2 +1 and FWL equal to b 1 +b 2 : 
         [0000]        q 1 [a   1   ,b   1   ]*q 2 [a   2   ,b   2   ]=q 3 [a   1   +a   2 +1 +,b   1   +b   2 ].   (9) 
         [0109]    The result of the product has double the word-length of the individual terms and is therefore typically reduced in word-length for subsequent calculations. A product like Equation (9) is denoted as: 
         [0000]      q3[a 3 ,b 3 ]=q1[a 1 ,b 1 ]*q2[a 2 ,b 2 ].   (10) 
         [0110]    where q3 appropriately reduces the word-length and applies the correct scaling so that the end-result has the required word-length and precision. 
       EXAMPLE  
       [0111]    The expression q3[4,23]=q1[0,11]*q2[7,16] implies one first has to multiply: 
         [0000]      q1[0,11]*q2[7,16]=tmp[8,27], 
         [0112]    then shorten and shift the intermediate result tmp[8,27] such that it becomes q3[4,23], in this case multiply the intermediate result by 2 23−(11+16) =2 −4 = 1/16, or simply shift the intermediate result right by 4: 
         [0000]        tmp[ 8,27]&gt;&gt;4= tmp[ 12,23], 
         [0113]    and finally shortening this 36 bit number to a 28 bit number by discarding the 8 most significant bits: 
         [0000]      q[4,23]=tmp[0:4,23]. 
         [0114]    A Method for Producing an Optimal Fixed-Point Controller Algorithm 
         [0115]    Algorithm precision, or desired word-length, and algorithm execution speed are conflicting requirements: the higher the desired precision, the longer it takes to execute the calculations. In addition, a typical digital processor only has limited logic resources, also called a processor&#39;s real estate. Even if one wishes to do all calculations using 64 bit integers, this is often not possible because of the limited resources. 
         [0116]    To find an optimal tradeoff between algorithm speed and precision, the presently preferred embodiment of the invention casts the algorithm quantization problem into the following optimization problem: 
         [0117]    Given a minimum set of equations that describes the algorithm, and a desired precision of the algorithm variables of interest, minimize the required word-length for each variable. By minimizing the required word-length for each variable, the speed of the algorithm is maximized. After optimization, just meet the desired precision of the output variables of interest, such as cantilever frequency and/or magnitude of oscillation. Optimization software is written that computes the minimum required word-length for each algorithm variable for a given desired precision of output variables of interest, thus maximizing algorithm speed. After optimization, there is no faster algorithm that still has the desired precision. 
         [0118]    The fact that the invention constitutes a very compact algorithm that includes all components, as described in  FIG. 2 , is a tremendous advantage for maximizing algorithm speed as well because individual components would consume logic resources independently of each other, therefore reducing algorithm speed. 
         [0119]    The presently preferred method of the invention for producing an all-in-one digital scanning force microscope controller thus comprises the following steps:
       Derivation of a minimal set of (physical) equations that define the entire algorithm, including all targeted cantilever control experiments. This set of equations is solved with the highest-possible precision using floating-point variables.   Breaking-up of complex floating-point equations into smaller equations that can be computed by a specific digital device.   Conversion of floating-point variables to fixed-point variables with a minimal word-length that yields a desired precision of key output variables. This step involves the above-described optimization.   Comparison, e.g. verification, of fixed-point equations against the high-precision floating point equations.   Implementation of the fixed-point equations in a specific digital device.       
 
         [0125]    Potential Applications 
         [0126]    Although the invention is described herein with reference to the preferred embodiment, one skilled in the art will readily appreciate that other applications may be substituted for those set forth herein without departing from the spirit and scope of the present invention. Since the invention enables imaging of subsurface features for the first time and has the unique capacity of being able to image nanoscale features with isotopic selectivity, the invention presents the potential for many applications. For example, magnetic resonance is one of the only techniques available for gleaning atomic-scale bonding information from disordered materials. Therefore it is expected that the invention will significantly improve magnetic resonance force microscopy (MRFM) for studying complex disordered materials such as catalytically active composites, fuel cells, and hydrogen storage materials, to list a few examples. The technology will have eventual broad utility, including but not limited to: research of advanced materials, advanced semiconductor devices and nanoelectronics (e.g. individual impurity and defect characterization, assaying spin injection in spintronics devices), emerging solid-state phenomena (e.g. investigations of electron spin coupling mechanisms and quantum computational physics), single molecule analytical chemistry, infectious disease research, and biotechnology. Specifically, the invention would allow one to form a three dimensional picture of any single protein, in situ, with all of its posttranslational modifications in place. It would also allow one to obtain the full structure of any membrane protein and we enable looking at any cell&#39;s outer membrane with all the proteins and lipids frozen in action together. It would allow one to focus study on just the reactive part of a molecule or a suspected binding site in a protein. The invention would open the door to studying impure samples, samples that can be isolated in only small quantities, and transient complexes. It would allow one to study the conformational heterogeneity among an ensemble of proteins in situ. 
         [0127]    The invention will also enable more powerful imaging in electric force microscopy (EFM) and atomic force microscopy (AFM). The atomic force microscope has become an extremely valuable tool for studying biological systems, and more than one paper a day is published detailing a biological application of atomic force microscopy. 
         [0128]    The ability of atomic force microscopy to study biological samples can be dramatically improved with the current invention. Current AFM hardware is poorly suited for state-of-the-art imaging and spectroscopy applications. For example, delicate frequency-shift AFM imaging of biological structures in water requires custom positive-feedback and frequency-measuring hardware, while force spectroscopy and high-speed tapping mode AFM imaging require custom negative-feedback circuitry. The current invention replaces this custom hardware with a single versatile all-digital cantilever controller capable of both types of cantilever control. 
         [0129]    Conclusion 
         [0130]    Herein disclosed is an innovative approach for cantilever control of Scanned Force Microscopes. The invention provides a method and apparatus that estimates the phase, frequency, and amplitude of the incoming signal, from which the small frequency shifts that translate to small shifts in cantilever spring constant are determined. It also provides the base signal for driving the cantilever. The amplitude estimation part that is used for amplitude control processes real-time cantilever tip deflection measurements and produces real-time commands to force-actuate the cantilever&#39;s motion in a desired fashion. A key aspect of the invention is a single digital software and hardware system that integrates many different components of SFM control, such as frequency estimation using a Phase-Locked Loop (PLL), amplitude estimation using a lock-in amplifier, phase compensation using an adjustable phase shifter, amplitude control using an amplitude controller, and more. Besides the advantage of replacing many analog components with one single digital component, a significant advantage of such all-in-one digital controller is the near-elimination of thermal drift during SFM experiments. Another significant advantage is its flexibility because one hardware design can be used with many different user-programmable software variations. Yet another advantage is its automatic adjustment to changing cantilever properties, compared to replacing breadboard components in state-of-the-art analog cantilever control. 
         [0131]    Another key observation related to the invention is the fact that execution speed of any digital algorithm has to be traded-off against bit accuracy of the algorithm variables, i.e. the more accurate the algorithm, the slower it executes. In addition to comprising an all-in-one digital algorithm, the disclosed invention also provides an optimal strategy for maximizing algorithm execution speed, while maintaining desired algorithm accuracy. 
         [0132]    The foregoing detailed description of the invention is provided for the purpose of illustration and is not intended to be exhaustive or to limit the invention to the precise embodiments disclosed. Accordingly the scope of the present invention is defined by the following Claims.