# Applied Scientific Instrumentation

### Products

 Custom Optics diSPIM FTP FW1000: Filter Wheel MPPI MS2000, MFC2000 and RM2000 Controller Piezo Systems RAMM, MIM and VTS Portal Serial Command Software TG-1000/Tiger Controller Tracking & Stabilization XY Stage Z-Drive and Focus Stage

scan_module

# SCAN MODULE MS 2000 Encoder Sync and Scanning Addendum

Raster and Serpentine scanning with the MS 2000 controller has been made simple and flexible with some special firmware and hardware options added to our standard controller. Raster scanning is often used in conjunction with other equipment which collects data during the scan, the objective being the generation of data that can be mapped accurately in the two spatial scan dimensions. To facilitate this data collection, the MS 2000 controller with the Encoder Sync option provides one or two TTL signal channels that are clocked to positional references. These signals are wired from the axis chosen by the customer when the controller is manufactured. The first channel, SYNC, provides a “start-of-line” reference signal that occurs as the stage scans across a predetermined positioned for every raster-scanned line.

Users can use just the SYNC line and constant stage speed along with uniform data sampling to achieve Imaging synchronization. The MS2000 can keep the stage speed on target to within a few encoder counts throughout the scan, so accompanied with a uniform sampling interval, accurate pixel rendition is possible without directly triggering the acquisition from the controller.

Two firmware options are available that involve how the TTL_IN interrupt is handled. If just the SYNC output, as described above is to be used, the controller is supplied with the IN0_INT firmware module which allows all of the normal TTL input functions to be available as described by the X-parameter options for the TTL command. For users that want the controller to supply a pixel clock we supply the EXT_INT firmware module. In this case normal TTL input functions are not available. Which firmware modules are in your controller can be determined with the BUILD query “BU X?”

Controllers running firmware with the EXT_INT interrupt option apply one channel of the stage encoder to the microprocessor's interrupt input. The controller “counts down” the encoder pulses and sends a output pulse on the TTL_OUT BNC connector after the programmable number of N encoder counts have gone by. In this way, the TTL_OUT signal can effectively be the pixel clock of the data acquisition system, where the user can program the distance between pixels.

## Raster and Serpentine Scanning

The user can select either Raster or Serpentine scanning modes using the SCAN F=mode command. During a Raster scan, the active scan begins at the same edge for each line, and is followed by a high speed retrace movement at the end of the scan line. For a Serpentine scan, the scan proceeds first in one direction, then in the opposite direction, advancing vertically one line each time the direction changes (there is no retrace movement). The “start-of-line” reference position is moved from one side of the scan area to the other depending upon the direction of the scan.

Raster scanning has the advantage that system backlash will be negligible, since the motion is always in the same direction. Serpentine scanning has the advantage of faster coverage (since there is no retrace operation) when very high accuracy is not required.

## Encoder SYNC Hardware

The encoder sync pulse is obtained directly from the encoder counting chip inside the controller. This encoder chip can be loaded with a “compare” position, so that whenever the current encoder count is equal to the “compare” count, a flag pin on the chip becomes active. We add additional circuitry to latch the sync pulse during the active part of the scan.

Pulses for the pixel clock are derived from a processed signal coming from the controller’s microprocessor (DIVIDE-by-N) on the normal TTL_OUT BNC connector. The pulses from the encoder are sent to an interrupt line on the controller’s microprocessor. The interrupt causes a programmable counter to count down. When the counter reaches zero, the microprocessor sends a pulse to the TTL_OUT connector. These pulses are only enabled during the active scan line.

Figure 1: Timing Example

## WK2000 Board Jumpers

Either the X or Y-axis can be used as the fast raster axis for scanning. Jumpers on the main controller card are used to select the appropriate wiring. The firmware defaults with the X-axis as the fast axis. When configured at the factory, the jumpers are set for a fast X-axis. The jumper configuration is shown in the table below.

Function Jumper Fast Axis
X Y
Sync Flag JP1 1-2 2-3
Encoder Pulses JP2 1-2 2-3

The output signals are found on header SV1. SV1 Pin 2 is the Encoder Divide by N output and SV1 Pin 7 is the Line Sync output. These pins should be connected to BNC connectors on the rear of the controller. (Controllers not specifically set up for the SCAN firmware will usually have SV1 Pin 2 connected to the TTL OUT BNC and SV1 Pin1 connected to the TTL IN BNC. In that case, switch the wire from Pin1 of the connector over to Pin 7 so that the Line Sync will appear on the TTL IN BNC.)

SCAN firmware versions that have the IN0_INT module rather than the ENC_INT module should leave JP2 unconnected since encoder pulse counting is not enabled in these versions. The ENC_INT module provides the interrupt service handling so the encoder pulses can be counted. The internal interrupt service must be enabled using the TTL command, TTL X=1.

## Using the SCANR, SCANV, and SCAN Commands

To perform a scan, you must first define the scan region, the pixel clock resolution, and the number of scan lines. The serial commands SCANR, SCANV, and SCAN let the user define the scan region, the scan mode, and initiate the scan process. See the programming section for a full description of these commands.

Let’s go through an example where we wish to scan a 1 mm × 1 mm region at a resolution of about 0.5 μm on an XY stage. We will consider the X axis to be the ‘horizontal’ direction, and Y to be the ‘vertical’ direction. (Although any axis is eligible to be ‘horizontal’, only one will have been wired at the factory for encoder output signals – see the SCAN command’s parameters for alternative configurations.) For a standard 6.35 mm pitch lead-screw stage, the encoder resolution is 45396 counts/mm or 0.022 μm/count. However, this resolution includes all of the quadrature edges of the two encoder channels. Our counting circuit is only looking at the positive edges of one encoder signal and hence sees a count spacing four times larger. The maximum count rate is every other pulse – which translates to 8 quadrature counts per output pulse. (If you are not sure of the encoder resolution of the scanned axis, issue the command INFO X, where X is the axis in question, to query the controller about the parameters that are used.)

If we generate a clock pulse every 24 encoder counts (6 full periods of a single encoder signal), then our pixel clock resolution will be 0.022 × 24 = 0.528 μm. To set up the ‘horizontal’ raster, we issue the command:

SCANR X=0.0 Y=1.0 Z=24 (X= start, Y= stop, Z=encoder_divide)

The command above will generate a scan line with 1891 pixels, determined by multiplying the encoder resolution by the length of the scan and dividing by the encoder_divide parameter. If you wish to specify exactly the number of pixels you want to have in a scan row, you may issue the command using the F = # of pixels, instead of Y = stop_positon.

For the ‘vertical’ direction, if we want square pixels, then we will need 1891 scan lines as well. To set up the ‘vertical’ scan, we issue the command:

SCANV X=0.0 Y=1.0 Z=1891 (X=start, Y=stop, Z=number_of_lines)

In both commands, parameters “start” and “stop” are measured in millimeters from the current origin (“Home” position), and negative values are allowed.

Next, we need to determine the correct scan speed based upon the processing time for each pixel. If we assume a 1ms time for each pixel, then we would want to scan at a rate of 0.528 μm/ms or 0.528 mm/s. To set this up for the X-axis we issue the command:

SPEED X=0.528

We can specify that the scan mode will be a raster scan using the command:

SCAN F=0

Finally, we need to turn on the encoder interrupt with:

TTL X=1

Once all of the scan parameters are set up the way we want them, it is possible to save them to non-volatile memory so that we do not need to re-enter them each time we power up.

The command to save settings is: SS Z
When ready to initiate the scan, issue the command: SCAN

to start the process. Alternatively, you can use the @ button on the controller to start and stop the scan. To start a scan, hold the @ button down for more than 1 second. When you release the button the scan will start. To abort a scan in process, momentarily depress the @ button.

## Limitations and Internal Operation of the SCAN module

During set-up for a scan, the number of horizontal pulses (pixels) is calculated. During the scan, pulses are counted until the requisite number has gone by. Further interrupts are disabled and the current encoder position is read in. If the current position is not consistent with the expected position based upon the number of pulses and the encoder counts between pulses, an error code is placed in the error log.

The internal data size for certain variables limits the acceptable range some parameters. The encoder-divide parameter and the total number of pixels per scan line must be less than 32768.

With the MS2000WK controller, internal jumpers JP1 and JP2 are used to select either the X-axis (jumper positions 1-2) or the Y-axis (jumper positions 2-3) as the fast scanned axis. Controllers are shipped with the X-axis as the default fast raster axis. Please see the SCAN command to change the default axes for the scanning algorithms. Only the X (default) or Y axis may be used when generating the hardware encoder synchronization TTL pulses. The firmware controlled scan patterns can be used with any pair of axes, however internal errors (code 85 & 86) will be generated if the proper internal signals are not present or jumped correctly.

Address: 29391 W Enid Rd. Eugene, OR 97402, USA | Phone: +1 (541) 461-8181