6 Z_byV

Example 6. Z_byV

    
MacroName Z_byV
##############################
# Z_byV.txt
# by Chen Xu, Oct  23, 2010, 
# Last modified: @ 2014-10-21 12:26:18
##############################
# 

Echo ===> Running Z_byV ...

#====================================
# for defocus offset of V in Low Dose, save it
# ===================================
GoToLowDoseArea V
SaveFocus

#==================
# set object lens 
#==================
SetEucentricFocus
#NormalizeLenses 2
#Delay 1

#===========
# Adjust Z
#===========
Loop 2
Autofocus -1 1
ReportAutofocus 
Z = -1 * $reportedValue1
MoveStage 0 0 $Z
echo Z has moved --> $Z micron 
EndLoop

#=========================================
# restore the defocus set in V originally
# ========================================
RestoreFocus

This macro is similar to the macro Z_byG, but for in Low Dose mode and using View area. If there is a defocus offset between V and R, then we need to save the defocus value for View area and restore it afterwards. This is accomplished by two macro commands SaveFocus and RestoreFocus.

Interestingly, I ran into problem when I stopped macro before it reaches RestoreFocus. The defocus value for View area got forgotten. Fortunately, internal mechanism of macro control takes care of this. As long as SaveFocus is executed, the defocus value will be restored even the macro is interrupted.

The command line


Autofocus -1 1

means to measure the defocus using V. The last argument 1 is for View area in Low Dose mode. This becomes very convenient, as we don't have to leave Low Dose mode.

Surprisingly, the accuracy of this method is rather good. Even at relatively low mag like in M range, it can be as accurate as within 1 micron or so.

Note: Depending on the stage, it might need to iterate more than twice. I have found that on our F30 which has older CompuStage it needs to loop 3 times to get it real close - less than half macron. However, on F20 which has newer CompuStage it only needs twice.