Abstract:
A method is described for obtaining an image of a target surface with a confocal microscope. The surface to be imaged is represented by a number of points on the surface, each of which has a unique location represented by X, Y, and Z Cartesian coordinates. The microscope selects a starting position for an objective lens of the microscope along a Z vector substantially normal to the surface. The objective lens has a preselected range of travel along the Z vector that is divided into a number of Z positions. Next, the objective lens is positioned and the surface scanned at each of the Z positions. The scan at each Z position provides signals, one for each point on the surface, representing the reflected intensity of laser light. Then, for each point on the surface, the microscope finds the Z coordinate of the point by determining which Z position resulted in the greatest return intensity of reflected laser light. From this information the Z coordinate of any particular point may be determined because the maximum reflected intensity for a given point, when correlated to the Z position of the objective lens, gives the Z location of that point on the surface. Having determined the Z locations for each point on the surface, the Z locations are compared to determine the low and high points on the surface. A second scan is then set up using the low and high points on the surface to determine the optimal scan parameters.

Description:
CROSS-REFERENCE TO RELATED APPLICATIONS 
     The present application is a continuation-in-part of commonly owned application Ser. No. 08/080,014, now U.S. Pat. No. 5,479,252, filed Jun. 17, 1993, entitled &#34;Laser Imaging System For Inspection and Analysis of Sub-Micron Particles,&#34; by Bruce W. Worster, Dale E. Crane, Hans J. Hansen, Christopher R. Fairley, and Ken K. Lee, and commonly owned application Ser. No. 08/183,536, now U.S. Pat. No. 5,483,055, filed Jan. 18, 1994, entitled &#34;A Method and Apparatus for Performing an Automatic Focus Operation,&#34; by Timothy V. Thompson, Christopher R. Fairley, and Ken K. Lee; and is related to the commonly owned, co-pending U.S. patent applications entitled &#34;Surface Extraction from a Three-Dimensional Data Set,&#34; by Ken K. Lee, application Ser. No. 08/079,193, filed on Jun. 17, 1993, and &#34;Surface Data Processor,&#34; by Abigail A. Moorhouse, Christopher R. Fairley, Phillip R. Rigg, and Alan Helgesson. These applications are incorporated herein by this reference. 
    
    
     COPYRIGHTED MATERIAL 
     A portion of the disclosure of this patent document contains material that is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document or the patent disclosure, as it appears in the Patent and Trademark Office patent files and records, but otherwise reserves all copyrights. 
     BACKGROUND 
     Semiconductor chip manufacturers have increasingly sought to improve yields in their production processes. Key to this effort is the identification of particulate contamination and wafer defects during wafer processing. One tool available to identify contamination and defects is a laser imaging system that utilizes confocal laser scanning microscopy techniques, also known as a confocal microscope. Such a microscope includes a laser light source that emits a laser beam focussed on a pinhole aperture in a focal plane of an objective lens. A beam scanner receives the beam after it exits the pinhole aperture and, using moving reflective elements, scans the beam through the objective lens and across a surface to be imaged. 
     The objective lens has a second focal plane, on the side of the objective lens opposite the pinhole aperture, in which an image of the pinhole aperture is formed. A photodetector in the return path of laser light reflected from the surface generates an output signal proportional to the intensity of laser light reflected from the object and back through the lens, the beam scanner, and the pinhole aperture. For a given point on the surface, the reflected intensity, and therefore the output signal from the photodetector, is highest when the surface lies in the second focal plane of the lens. This is because the objective lens focusses the reflected image of the pinhole aperture back through the pinhole aperture to the photodetector. In contrast, when the surface does not lie in the second focal plane, the image of the pinhole aperture is out of focus (i.e., the diameter of the image on the surface is much larger than the aperture) so that most of the reflected image does not return through the pinhole aperture. 
     To obtain an image of a target surface, the target surface is scanned in a number of X-Y planes located along a Z axis generally normal to the target surface. In each scan, the photodetector provides indications of the intensities of the reflected laser light from a number of points on the surface. That is, the objective lens is positioned at each location on the Z axis and the laser beam is scanned across the surface to generate a number of signals, each of the signals representing an intensity of light reflected through the objective lens from a given point on the surface. The group of signals provided by an X-Y scan from a single location of the objective lens on the Z axis is called a &#34;slice&#34; of intensity data. Slices taken from the various locations on the Z axis overlap to form a three-dimensional set of reflected intensity data. 
     The overlapping slices of data create a column of data values for each point on the surface, each data value representing a reflected intensity of light from that point from a particular Z location. For each such column, data values are compared to determine the location on the Z axis that resulted in a maximum reflected intensity. Because the intensity of the reflected light from a particular point is greatest when that point on the surface is coincident with the focal plane of the objective lens, the location of the objective lens on the Z axis that corresponds to the maximum reflected intensity gives an indication of the Z coordinate of that point on the surface. In this way, the X, Y, and Z Cartesian coordinates are determined for each point on the surface. An image of the surface may then be generated from this information. 
     For a more detailed description of such a laser imaging system, see the co-pending application entitled &#34;Laser Imaging System For Inspection and Analysis of Sub-Micron Particles,&#34; the content of which is incorporated herein by reference. 
     Confocal microscopes require the user to input sample-specific data before an image of the target sample can be obtained. For example, the user might have to specify the optimal photodetector gain for measuring laser-light reflected from the target surface, the offset in the Z-direction from which the first X-Y scan will begin, the range to be covered in the Z direction, and the optimal number of &#34;slices&#34; taken along the Z axis to form the three-dimensional set of reflected intensity data. 
     Assume, for example, that time constraints limit the number of slices to fifty. If the sample is very flat, resolution should be maximized by taking the fifty slices over a relatively short Z range, whereas if the surface of the sample is relatively rough (i.e., the surface features are &#34;tall&#34;), the distance between adjacent slices should be optimized so that the total Z range captures the low and high regions of the surface. And, whatever the surface texture, the scan range should be optimized so that the scan precisely covers the Z range of the surface features so that almost all of the fifty slices provide surface data. 
     Unfortunately, the process of setting up a confocal microscope for different types of target samples can be difficult and tedious. There is therefore a need to obtain a surface image using a confocal microscope without requiring the user to manually optimize scan parameters. 
     SUMMARY 
     The present invention fills the need for a confocal microscope that automatically sets the optimal vertical scan range (i.e., Z-scan range) and photodetector gain for a given target sample. In accordance with this invention, a user is able to automatically set the Z-scan start point, Z-scan range, and optimal photodetector gain. A manual method of setting the scan parameters is still supported, and may be needed in special circumstances, as where the surface features are very tall, or for multi-layered samples. 
     In one embodiment, a button, called the &#34;SetZ&#34; button, is provided to allow the user to enter the automatic mode. When a user presses the SetZ button, the program performs a number of scans along the Z axis over a scan range that is long relative to typical surface features. From this, the system obtains a coarse measurement of highest and lowest points on the surface (i.e., the greatest and the least Z values on the scanned surface). The system then uses this information to set the Z positions at which the Z stage will start and stop during a subsequent series of scans. 
     The Z-scan starting point for the microscope on the Z axis is set to the Z position corresponding to the highest point on the surface plus a safety margin. Similarly, the end Z position is set to the lowest point measured minus a safety margin. The laser imaging system also uses the maximum reflected intensity obtained from the SetZ scan to set the optimal photodetector gain, and therefore the perceived reflected laser intensity, for the sample. 
     Having determined and set the photodetector gain, Z-scan start position, and the Z-scan stop position, the system evenly divides the distance between the start and stop positions by one less than the number of available Z-steps and moves the fine Z stage to the start Z position. 
     The system may then image the target surface by (1) taking a selected number of slices of intensity data along the Z axis (e.g., fifty slices) from the Z-scan start position to the Z-scan stop position and (2) using the data obtained to determine the location of a number of points on the surface of the target surface. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a simplified block diagram of a confocal microscope system according to an embodiment of the invention; 
     FIGS. 2a-2c show a target of a confocal microscope below the focus position, at the focus position and above the focus position, respectively, illustrating, at each position, the pattern of light reflected from the target; 
     FIG. 3 is an idealized graph of an electronic focus signal of a confocal scanning laser microscope as the target is moved along the Z-axis; 
     FIG. 4 is a block diagram of a Z-axis controller used to control a fine Z-stage and to provide feedback to a coarse Z-stage; 
     FIGS. 5a-5e are schematic diagrams of the Z-axis controller of FIG. 4; and 
     FIGS. 6A and 6B describe the process of obtaining surface information with which to determine and set the scan parameters appropriate for a particular sample. 
    
    
     DETAILED DESCRIPTION 
     FIG. 1 is a simplified block diagram of a confocal microscope system 100 according to an embodiment of the invention. A confocal microscope system with which the method according to the invention can be used is described in more detail in commonly owned U.S. patent application, Ser. No. 08/080,014, entitled &#34;Laser Imaging System for Inspection and Analysis of Sub-Micron Particles,&#34; the disclosure of which is incorporated herein by reference. A laser 102 generates a laser beam 123 that is transmitted through a beam splitter 104, reflected from an X-mirror 106 and a Y-mirror 108, and transmitted through an objective lens 110 to the surface of a target 112. In one embodiment, laser 102 is a conventional argon-ion laser, however, other types of lasers may be utilized in alternate embodiments. 
     Target 112 is an object, such as a semiconductor wafer, that is to be viewed using microscope system 100. X-mirror 106 and Y-mirror 108 are each rotatable about an axis such that laser beam 123 can be moved along an X-axis and a Y-axis, respectively, of target 112. Laser 102, beam splitter 104, X-mirror 106, Y-mirror 108 and objective lens 110 are each conventional structures that are well known by those skilled in the art. 
     Laser beam 123 reflects off the surface of target 112 in a manner that is dependent upon the distance of objective lens 110 from target 112. FIGS. 2a-2c show target 112 below the focus position 203, at the focus position 203 and above the focus position 203, respectively, illustrating, at each position, the pattern of light reflected from target 112. 
     As illustrated in FIGS. 2a and 2c, when target 112 is positioned below or above the focus position 203, respectively, a small percentage of the laser light originally transmitted through objective lens 110 will be reflected back through objective lens 110 in a coherent manner. However, as shown in FIG. 2b, when target 112 is positioned at the focus position 203, substantially all of the reflected laser beam 123 is transmitted back through objective lens 110. 
     Referring again to FIG. 1, laser beam 123 is reflected from target 112 back through objective lens 110 to Y-mirror 108, X-mirror 106, and beam splitter 104. A mirror control 124 is coupled between a host work station 116 and X and Y mirror 106 and 108. Mirror control 124 is used by the work station to rotate X-mirror 106 and Y-mirror 108 such that laser beam 123 can scan more than a single point on target 112. 
     Beam splitter 104 routes the reflected beam to a photodetector 114. Photodetector 114 is a device such as a photo-multiplier tube (PMT) or photo-diode that generates an analog electronic focus signal on lead 115 proportional to the intensity of reflected laser beam 123 measured by photodetector 114. The photodetector gain must be appropriately calibrated for the laser power, laser wavelength and type of target 112 being viewed. This calibration is discussed below in connection with FIGS. 6A and 6B. In one embodiment, the PMT used is a Hamamatsu PMT, part number R268. 
     The electric focus signal on lead 115 is provided to host work station 116 and to Z-axis controller 118. Z-axis controller 118 is directly coupled to fine Z-stage 120 and is indirectly coupled to coarse Z-stage 122 through host work station 116 and coarse Z-axis controller 117. Coarse Z-stage 122 uses a motor, such as a stepper motor, to move target 112 through a relatively large range of motion along the Z-axis. In one embodiment of the present invention, the coarse Z-stage controller 117 is a conventional stepper motor controller available as part number 310MX3 from New England Affiliated Technology, and coarse Z-stage 122 is driven by a conventional stepper motor such as the Vexta C5858-9012 available from Oriental Motor. As explained in more detail below, fine Z-stage 120 uses a piezoelectrically driven element to move target 112 through a smaller range of motion along the Z-axis than coarse Z-stage 122. Although the invention is described as having a movable target 112 and a stationary objective lens 110, it is understood that target 112 can be held stationary while objective lens 110 is moved or both can be moved relative to each other. 
     FIG. 3 is an idealized graph of the electric focus signal on lead 115 as target 112 is moved along the Z-axis relative to objective lens 110. The electric focus signal on lead 115 is theoretically a sinc-squared function ((sin(x)/x) 2 ) having a full-width, half-max measurement 305 that varies based on the numerical aperture of the objective lens 110 and the wavelength of laser beam 123. The full-width, half-max measurement 305 is the width of the electric focus signal on lead 115 (along the Z-axis) at the point on the Z axis at which the electric focus signal on lead 115 is at half of its maximum amplitude. For example, an objective lens 110 having a power of 100× and a numerical aperture of 0.95 and a laser beam 123 with a wavelength of 488 nanometers (nm) will produce an electronic focus signal on lead 115 with a full-width, half-max measurement of approximately 0.5 microns. 
     The electric focus signal on lead 115 exhibits a distinct focus position 203 in main lobe 307 as shown by peak 301. The electric focus signal also exhibits two side lobes 306a-306b. The depth of focus 302 is defined by the Z-axis range at which the magnitude of the electric focus signal on lead 115 is greater than a background value 303. The small non-zero background value 303 of the electronic focus signal on lead 115 results from leakage currents and the small amount of background light that reaches photodetector 114. The depth of focus 302 becomes smaller as the numerical aperture of objective lens 110 increases or as the wavelength of the laser beam 123 decreases. In the following discussion, the objective lens 110 has a power of 100× and numerical aperture of 0.95, and laser beam 123 has a wavelength of 488 nm, unless otherwise noted. 
     FIG. 4 is a block diagram of Z-axis controller 118, which controls the fine Z-stage 120 and also provides feedback used to control coarse Z-stage 122. Within Z-axis controller 118, the electric focus signal on lead 115 is transmitted to a first input terminal of comparator 401 and to an input of an analog to digital converter (ADC) 407. The output of ADC 407 is coupled to a microprocessor 403, which monitors and controls various components of the microscope, as described below. 
     The output terminal of comparator 401 is coupled to the set terminal of latching flip-flop 402. The Q output terminal of flip-flop 402 is coupled to an input of status register 405. An output signal from control register 406 is coupled to the reset terminal of flip-flop 402. The microprocessor 403 is coupled to status register 405, control register 406, digital to analog converter (DAC) 404, ADC 407 and host work station 116. The output terminal of DAC 404 is coupled to a second input terminal of comparator 401. Microprocessor 403 is also coupled to position control register 408. The output signal from position control register 408 is transmitted through DAC 409, integrator 420, summing node 410 and amplifier 411 to provide a control voltage to a piezoelectric element 1130 of the fine Z-stage 120. The summing node 410 also receives a feedback signal from a proximity sensor 1135 of the fine Z-stage 120. 
     FIGS. 5a-5e are schematic diagrams of the Z-axis controller 118 of FIG. 4. Similar elements in FIGS. 4 and 5a-5e are labelled with the same number. As shown in FIG. 5d, central processing unit (CPU) 5000 of microprocessor 403 transmits and receives information through bus transceiver 5034 to 8-bit data bus 5006. CPU 5000 is a TP-RS485 twisted-pair control module, model number 55050-00, available from Echelon. Bus transceiver 5034 provides additional drive capability to CPU 5000. 
     Bus transceiver 5034 is a well-known device, available as part number 74ALS245, from Texas Instruments (TI). When the microprocessor 403 attempts to access a particular device within the Z-axis controller 118, the CPU 5000 sends address information corresponding to that device to address register 5036 through bus transceiver 5034 and over data bus 5006. (Address register 5036 is available from TI as part number 74ALS573.) The output signal of address register 5036 is provided to address decoders 5038 and 5040, which decode the output signal and generate control signals to the device being accessed. For example, if the CPU 5000 sent address information directed to enabling the input of video data, address decoder 5040 would output a logic zero on SEL --  VIDEO*, thereby closing video input switch 5022 of FIG. 5c. Address decoders 5038 and 5040 are available from TI as part numbers 74ALS138 and 74LS139, respectively. 
     Microprocessor 403 communicates with position control register 408, status register 405, control register 406, DAC 404 and ADC 407 using 8-bit data bus 5006. 
     As shown in FIG. 5a, registers 5001 and 5003 within position control register 408 receive positioning information from microprocessor 403 on data bus 5006. Registers 5001-5004 are known in the art. Registers 5001 and 5003, available from TI as part number 74ALS574, serve as buffer registers that, when clocked, make the eight-bit data word on data bus 5006 available as input to registers 5002 and 5004. Registers 5002 and 5004, available from TI as part number 74ALS273, serve as storage registers that, when clocked by the signal LD --  DAC*, store the eight-bit data words output by registers 5001 and 5003 and apply these data words to the input of 12-bit DAC unit 5008 of DAC 409. DAC unit 5008 is a conventional DAC, known in the art, and available from Analog Devices as part number AD7541. The remaining ancillary elements of DAC 409 (including operational amplifier 5009 and the illustrated resistors, capacitors, and diodes) are conventional elements known in the art. Operational amplifier 5009 is available from Analog Devices as part number OP-177E. DAC 409 provides an analog output signal on lead 5010. 
     As shown in FIG. 5b, lead 5010 is connected to one input of operational amplifier 5012 of summing node 410. Operational amplifier 5012 is available as part number AD712 from Analog Devices. The other input to operational amplifier 5012 is derived from the position feedback signal provided by a position sensor (not shown) in fine Z-stage 120 with an output coupled to a connector 1135. Operational amplifier 5018 is available from Analog Devices as part number AD712. Operational amplifier 5018 an its associated resistors and capacitors are configured as a conventional buffer. 
     The output signal from operational amplifier 5018 is provided to the inverting input of operational amplifier 5012. The output signal from summing node 410 is coupled to the input of a conventional integrator 420, which includes an operational amplifier 5016, such as part number AD712 available from AD, and associated elements. 
     The output signal from integrator 420 is provided to notch filter 5013, which includes two resistors and two capacitors. The output signal from notch filter 5013 is provided to operational amplifier 5014, which is available from Analog Devices as part number ad712. The output signal from operational amplifier 5014 is provided to the input of amplifier 411. 
     Amplifier 411 is a conventional amplifier that includes an operational amplifier available from Apex as part number PA85. The combination of diodes, resistors, and capacitors associated with amplifier 411 are all known in the art. The output signal from amplifier 411 is provided through a connector 1130 to a piezoelectric element (not shown) within the fine Z-stage 120. 
     As shown in FIG. 5c, the electric focus signal on lead 115 is provided to ADC 407. The electronic focus signal on lead 115 is routed through multiplexer 5022 to operational amplifier 5020. Multiplexer 5022 is a conventional part available from Siliconix as part number DG 211. Operational amplifier 5020, available from Analog Devices as part number AD843, buffers the electric focus signal on lead 115. The output signal from operational amplifier 5020 is provided to an input of ADC unit 5021. ADC unit 5021 is a conventional part available as part number AD7575 from Analog Devices. The other devices coupled to ADC unit 5021, as illustrated in FIG. 5c, are known in the art. In response to the electric focus signal on lead 115, ADC unit 5021 outputs an 8-bit digital signal representative of the electric focus signal on lead 115. The 8-bit digital output signal of ADC unit 5021 is provided to microprocessor 403 on data bus 5006. 
     FIG. 5c also illustrates flip-flop 402. Flip-flop 402 is programmed as one of the devices present within programmable logic device (PLD) 5023. PLD 5023 is available from Lattice Semiconductor as part number GAL20RA10. The inputs to PLD 5023 include a set input from comparator 401 and a reset input from control register 406. PLD 5023 processes these inputs and generates an output representing the Q output signal from flip-flop 402. This Q output is provided to status register 405. (PLD 5023 also has inputs and outputs unrelated to automatic focus operations.) 
     FIG. 5d illustrates status register 405, which is a conventional register available as part number 74ALS541 from TI. As previously discussed, status register 405 receives the Q output signal from flip-flop 402. (Status register 405 also receives other information unrelated to automatic focus operations.) The 8-bit output signal from status register 405 is provided to data bus 5006 such that microprocessor 403 can detect when flip-flop 402 sets. 
     Control register 406 (FIG. 5d) receives an 8-bit input from microprocessor 403 on data bus 5006. Control register 406 is available from TI as part number 74ALS273. An output signal from control register 406 is coupled to PLD 5023, such that a signal from control register 406 can reset flip-flop 402. 
     Referring again to FIG. 5a, DAC 404 also receives an 8-bit input from microprocessor 403 on data bus 5006. This 8-bit input is transmitted through register 5007 (available from TI as part number 74ALS574) to conventional DAC unit 5011 (available from National Semiconductor as part number DAC0808). DAC unit 5011 converts the incoming 8-bit signal to an analog output signal. This analog output signal is provided to an input of operational amplifier 5017 (available from Analog Devices as part number AD712). The output signal from operational amplifier 5017 is provided to an input of comparator 401. The electric focus signal is provided to the other input of comparator 401. Comparator 401 includes comparator unit 5019, available from National Semiconductor as part number LM311. The output signal from comparator 401 is provided to flip-flop 402. 
     FIG. 5e illustrates the power supply connections 5041, 5042 and analog/digital grounding structure 5043 for Z-stage controller 118. 
     FIGS. 6A and 6B describe the process of obtaining surface information with which to determine and set the scan parameters appropriate for a particular target 112. In one embodiment, a user instigates this process by selecting a &#34;SetZ&#34; button. For example, the SetZ button may be an icon on a computer screen associated with host work station 116, or the SetZ function may be assigned to a function key. 
     The computer code used to perform a SetZ operation in accordance with an embodiment of the present invention is set forth in the Appendix. The computer code of the Appendix is written in C, a well-known programming language. 
     Beginning at step 1 of FIG. 6A, the gain of photodetector 114, and hence the measured intensity of laser beam 123 reflected from target 112, is grossly adjusted. In one embodiment, for example, photodetector 114 is a photo-multiplier tube (PMT) that includes a gain terminal 114A. The gain of the PMT is adjusted by changing the voltage on gain terminal 114A. In one embodiment, a digital-to-analog converter (not shown) is coupled between work station 116 and gain terminal 114A so that the gain of photodetector 114A may be set by supplying an appropriate digital input to the digital-to-analog converter. 
     In step 1, the input voltage on gain terminal 114A is compared to a pre-determined upper limit. If the gain voltage is greater than this upper limit, the gain voltage is set to the upper limit. If, on the other hand, the gain voltage is less than a predetermined lower limit, the gain voltage is set to the lower limit. The upper limit is selected to ensure that a reflected surface image does not saturate the photodetector 114, the lower limit to avoid errors due to a low signal-to-noise ratio. Finally, if the gain voltage is within the established limits, the gain voltage is left alone. 
     As shown FIG. 6A, once the gain voltage on gain terminal 114A is set within the established limits, system 100 moves to step 2 of FIG. 6A, in which system 100 determines the Z range over which to scan target 112. The range of motion of fine Z-stage 120 is, in one embodiment, 50 microns. That is, host work station 116, through Z-axis controller 118, can direct fine Z-stage 120 to move vertically to cover a total distance of up to 50 microns. However, wafer features are typically much smaller than 50 microns, so a 50 micron SetZ scan would be unnecessarily large. Therefore, the SetZ scan range (i.e., the &#34;scan window&#34;) is normally configured to be something less than 50 microns. A typical scan window is, for example, 25 microns. 
     The scan window is normally centered on focus position 203, so the start point of the scan (&#34;Z start  &#34;) is determined by adding half of the predetermined Z scan range to focus position 203, and the stop point of the scan (&#34;Z stop  &#34;) is determined by subtracting half of the predetermined Z scan range from focus position 203. 
     When focus position 203 plus half the scan range is above the maximum Z height attainable with fine Z-stage 120 (&#34;Z max  &#34;), Z start  is set to Z max  and Z stop  is set to Z max  minus the scan range. Similarly, when focus position 203 minus half the scan range is below the minimum Z height attainable with fine Z-stage 120 (&#34;Z min  &#34;), Z stop  is set to Z min  and Z start  is set to Z min  plus the scan range. 
     In one embodiment, an automatic focus operation may be performed prior to step 2 to determine the approximate focus position 203 of the sample surface within the coarse scan range of the microscope. The autofocus operation is generally not required in the SetZ sequence shown, as an autofocus is normally performed prior to the SetZ operation. Furthermore, once an autofocus is performed on one portion of a relatively flat target, such as a semiconductor wafer, it is generally unnecessary to perform subsequent autofocus operations for other points on that target. In such cases, the automatic focus operation is not performed more than once because it wastes valuable time. For a more detailed description of automatic focusing, see the commonly owned application entitled &#34;A Method and Apparatus for Performing an Automatic Focus Operation,&#34; the content of which is incorporated herein by reference. 
     As shown in steps 3 and 4 of FIG. 6A, once host work station 116 obtains the Z start  and Z stop  positions, host work station 116 directs Z-axis controller 118 to move fine Z-stage 120 to the Z start  position. System 100 then begins a series of scans of the surface of target 112, moving step-by-step toward Z stop , to acquire a slice of data values for each Z position. 
     As system 100 scans the surface of target 112 from each Z position, the maximum reflected intensity and Z location corresponding to the maximum reflected intensity are determined for each point (X-Y coordinate) on the surface of target 112. This information is used to create an array of maximum intensity values and an array of Z values corresponding to the location along the Z axis of each of the maximum intensity values. 
     In one embodiment, each intensity value of each slice of intensity data is compared to a maximum intensity value corresponding to the same X-Y coordinate in the array of maximum intensity values. If the intensity value of the slice is greater than the corresponding maximum intensity value, then the intensity value of the array of maximum intensity values is updated with a new maximum intensity value for that X-Y coordinate and the array of Z values is updated with the Z location of the new maximum intensity value. Because the point of maximum reflected intensity gives an indication of the location of the surface, the array of Z values provides an indication of the surface contour. 
     In a second embodiment, the maximum reflected intensity and Z location associated with the maximum reflected intensity for a particular point on the surface may be determined by comparing each data value associated with that point after slices of data are obtained and stored for all Z locations. This second method is slower and requires more memory than the first, as it is necessary to store all of the data values for each slice. 
     For a more detailed description of confocal microscope surface extraction techniques, see the copending application entitled &#34;Surface Extraction from a Three-Dimensional Data Set,&#34; the content of which is incorporated herein by reference. 
     As shown in step 5 of FIG. 6A, upon completion of the surface scan, fine Z-stage 120 issues an interrupt signal to work station 116, indicating that the data acquisition is complete. 
     The number of steps in a SetZ scan is user-configurable. Generally, a greater number of steps provides for better image resolution along the Z axis. Unfortunately, each scan step takes time. For this reason, the number of steps (i.e., the number of &#34;slices&#34; of surface data) is limited. Moreover, the minimum step size is limited by the resolution of the microscope. For example, in the embodiment described in connection with FIG. 3, the half-max measurement 305 of 0.5 microns limits the resolution of the microscope in the Z direction such that providing a step size of less than 0.5 microns will not further increase resolution. For the foregoing reasons, one embodiment uses 50 steps over a scan range of 25 microns, yielding a step size of 0.5 microns. 
     In step 6, host work station 116 smooths the intensity data stored in the array of maximum intensity values by, for example, averaging the intensity values for a number of neighboring X-Y locations. In one embodiment, the work station 116 divides the X-Y locations into groups of nine (i.e., a three-by-three grid of X-Y locations) and assigns each group an average intensity value I ave  equal to the average of the maximum intensity values corresponding to the X-Y locations in that group. This smoothing minimizes the effects of noise on the intensity data. 
     In step 7 of FIG. 6B, host work station 116 compares each I ave  value to the others to obtain the maximum I ave . Then, in step 8, each I ave  value is compared to a minimum-intensity threshold value to determine whether the resulting Z value for that group of pixels may be trusted. The minimum-intensity threshold value is established using the minimum and maximum I ave  values. For example, in an embodiment that uses an intensity scale of from 0 to 255 to determine the PMT voltage on gain terminal 114A, the minimum-intensity threshold is established using the equation: 
     
         MinumumThreshold=MinI.sub.ave +8+(MaxI.sub.ave -MinI.sub.ave)/16 
    
     where MinI ave  is the minimum average intensity value and MaxI ave  is the maximum average intensity value. 
     If the reflected intensity is too low, the resulting Z value may be erroneous due to a relatively low signal-to-noise ratio. For this reason, the Z values associated with X-Y locations having I ave  values below the minimum threshold are set to the average Z value (i.e., the average feature height) for target 112. This function reduces the effects of noise on the Z values used to set the scan parameters. 
     In step 9, host work station 116 smooths the data stored in the array of Z values by, for example, averaging the Z values for a number of neighboring X-Y locations. In one embodiment, work station 116 divides the X-Y locations into groups of nine (i.e., a three-by-three grid of X-Y locations, wherein each X-Y location has a corresponding Z value) and assigns each group an average Z value Z ave  equal to the average of the Z values corresponding to the X-Y locations in that group. This smoothing minimizes the effects of noise on the Z data. 
     Next, in step 10, work station 116 optimizes the gain of photodetector 114 by adjusting the voltage on gain terminal 114A. The maximum I ave  value (&#34;I ave .sbsb.-- max  &#34;) is compared to a predetermined ideal maximum intensity value. If the maximum I ave  is less than the ideal value, then the gain of photodetector 114 is increased. If, on the other hand, the maximum I ave  is greater than the ideal value, then the gain of photodetector 114 is decreased. In the embodiment that uses a Hamamatsu R268 PMT, the gain may be set to provide a desired maximum output level on lead 115 using the equation: ##EQU1## where &#34;Ideal I&#34; is the desired maximum measured intensity output from PMT 114. The resulting ΔGain is added to the current digital gain setting input to the digital-to-analog converter (not shown) coupled between work station 116 and gain terminal 114A. Of course, other types of photodetectors could be used that have different relationships between input voltage and intensity, in which case it would be necessary to determine the relationship between the gain and the input voltage to properly set the gain. 
     Finally, in step 11, the maximum measured Z value (&#34;Z M  &#34;) and the minimum measured Z value (&#34;Z m  &#34;) are used to calculate a safety margin S M  for a subsequent scan. This safety margin is added to Z M  and subtracted from Z m  to determine the start and end points, respectively, of the next scan. In other words, Z start  =Z M  +S M , and Z stop  =Z m  -S M . 
     Many different methods may be used to calculate an appropriate safety margin S M . In one embodiment, for example, the safety margin S M  is equal to 2.5 microns plus 20% of the difference between Z M  and Z m . (i.e., S M  =2.5 microns+0.2(Z M  -Z m )). 
     The microscope may be configured to perform a number of different actions after establishing the appropriate Z-scan and photodetector gain settings. For example, the host work station 116 may prompt the user for further instructions, or may scan the surface from Z start  to Z end , dividing the distance between Z start  and Z end  into the preconfigured number of steps (e.g., 50 steps), thereby generating a three-dimensional set of data values. System 100 can then extract a surface image of target 112 from this three-dimensional set of data values. (One method of performing such an extraction is detailed in the co-pending application entitled &#34;Surface Extraction from a Three-Dimensional Data Set,&#34; the content of which is incorporated herein by reference.) 
     While the present invention has been described in connection with specific embodiments, variations of these embodiments will be obvious to those having ordinary skill in the art. For example, although the present invention was described in connection a particular auto-focus scheme, other auto-focus schemes are available to provide the location of target 112. Additionally, while the invention is described in connection with microscope that reflects a maximum intensity to the photodetector during a focused condition, it is clear that the invention may be modified to operate with a microscope that reflects a minimum intensity to the photodetector during a focused condition. Therefore, the spirit and scope of the appended claims should not be limited to the description of the preferred versions. ##SPC1##