STMAFM Remote Operation
Contents
- 1 OLE/COM Server
- 2 Python Connection
- 3 Matlab Connection
- 4 Plugins
- 5 Commands
- 5.1 stmbeep
- 5.2 setparam
- 5.3 getparam
- 5.4 scanstart
- 5.5 scanwaitfinished
- 5.6 scanstop
- 5.7 scanstatus
- 5.8 quicksave
- 5.9 filesave
- 5.10 fileload
- 5.11 vertsave
- 5.12 latsave
- 5.13 savedatfilename
- 5.14 loadfilename
- 5.15 savevertfilename
- 5.16 savelatfilename
- 5.17 btn_vertspec
- 5.18 btn_vertspec_line
- 5.19 btn_vertspec_mult
- 5.20 btn_tipform
- 5.21 btn_timespec
- 5.22 scandata
- 5.23 scandatawrite
- 5.24 scanauxdata
- 5.25 openscanchannel
- 5.26 linescandata
- 5.27 timespecdata
- 5.28 timespecfftdata
- 5.29 latmandata
- 5.30 vertdata
- 5.31 pllspecdata
- 5.32 strbuffer
- 5.33 pllfreqscan
- 5.34 vertspectrum
- 5.35 move_tip
- 5.36 move_tip_imagecoord
- 5.37 latmanip
- 5.38 latmanipxymove
- 5.39 latmanbufferext
- 5.40 lockinstart
- 5.41 lockinstop
- 5.42 updatedspparam
- 5.43 updatedspfbparam
- 5.44 sliderup
- 5.45 sliderdown
- 5.46 slider
- 5.47 setdacval
- 5.48 setdacvalf
- 5.49 getadcval
- 5.50 getadcvalf
- 5.51 getdacvalfb
- 5.52 digoutvalue
- 5.53 sbcdigoutvalue
- 5.54 serverneverclose
- 5.55 execmethod
- 5.56 setxyoffvolt
- 5.57 setxyoffpixel
- 5.58 scandatabitmap
- 5.59 pc32scanstatus
- 5.60 setchmodezoff
- 5.61 stmready
- 5.62 setrampdspparam
OLE/COM Server
To register the OLE/COM sever in the stmafm program goto "Debug" and "Register COM Server". If you are going to install a newer version of the program, please click "Unregister COM Server" before installing the new version. Both has to be done with administrative rights as it requires access to the Windows registry.
You may also run "pstmafm.exe / regserver" form the command prompt. (Alternatively run "pstmafm.exe /regserverperuser" in case you have problems running /regserver in Windows 7) Again administrator rights are required.
There are many different software tools available to perform data analysis as well as data aquisition or remote operation of the STMAFM program via OLE/COM:
1. Python (Freeware, please visit http://winpython.sourceforge.net/ for download) we're using WinPython 2.7.x 32bit, 64bit
2. Commercial Software: MatLab / LabView
3. For more specific purposes with a more elaborate user interface Createc can supply dedicated plugin programs. (Contact ltspm@createc.de to solve your specific needs)
For simple scripting purposes, i.e. controlling the program without data analysis a scripter program is can still be used.(e.g. MAXBOX) But for people starting from scratch we recommend using the OLE/COM interface as we will drop the support via the TCPIP interface in future.
Example software will be provided through the Createc WebSite.
Python Connection
We recommend to install WinPython 2.7.x and using the IPython Notebook therein. These command will initialize the connection to the STMAFM program. Afterwards you may import / export files using filters from the program and control the complete software
import win32com.client
stm=win32com.client.Dispatch("pstmafm.stmafmrem")
stm.stmbeep()
Matlab Connection
You can access the pstmafm.stmafm OLE/COM server directly from Matlab (or Freemat using a corresponding dll). We recommend controlling the STMAFM program through this interface.
stm=actxserver('pstmafm.stmafmrem'); %Open connection to STMAFM program, see also Matlab manual.
stm.stmbeep; %
stm.release; % release stm program
The STMAFM program will be started and closed automatically from Matlab. If the STMAFM program is already running just the connection will be established.
Demo Startstm.m with event capability
global stm
global stm1
global linescandata
stm=actxserver('pstmafm.stmafmrem');
stm1=actxserver('pstmafm.stmafmevent');
stm1.registerevent('serverevents');
%registerevent: register a file serverevents.m to handle events.
Example: serverevents.m
function serverevents(varargin) global stmoleeventnr global linescandata global stm stmoleeventnr = cell2mat(varargin(3)); linescandata = stm.linescandata; if (stmoleeventnr == 1) plot(linescandata(:,1),linescandata(:,2)); end
Plugins
Specifically developed Plugins will be available to supply specific user needs. In particular where a more elaborate graphical user interface is necessary compared to a simple text based scripting control.
Commands
stmbeep
Parameter : None
Return: None
Function: STMAFM program creates a short beep sound. Used for testing purposes.
setparam
Parameter : (Strings) 1. Name of parameter 2. New Value
Return:
Function: Sets a parameter to a new value. The name is the name appearing in the old parameter menue
Example: stm.setparam('Rotation','90.00');
getparam
Parameter : 1. Name of parameter
Return: 1. Value of Parameter
Function: Gets the actual parameter value. The name is the name appearing the old parameter menue
Example: a=stm.getparam('Rotation');
scanstart
Parameter : None
Return: None
Function: Starts a new STM scan. Similar to pressing the button Scanstart
scanwaitfinished
Parameter : None
Return: None
Function: Waits until the active scan is stopped.
scanstop
Parameter : None
Return: None
Function: Stops a running STM scan. Similar to pressing the button Scanstop
scanstatus
Parameter : None
Return: Status Number ( = ord(scanstat) see below)
Function: Gets the present scanstatus.
scanstat = (scanstatreset, stop, running, start, resetting, pause, scanstatvertman, scanstatlatman, scanstattimespec, scanxyoffset,scanstatapproach);
0, SCANSTATRESET: Programm is in idle state 1, STOP: Running Scan is stopped but is not fully reset yet. 2, RUNNING: Scan is running 3, START New Scan is started but not yet running 4, PAUSE Running Scan is paused 5, SCANSTATVERTMAN VertSpectrum is running 6, SCANSTATLATMAN LATManip is running 7, SCANSTATTIMESPEC Timespectrum is running 8, SCANXYOFFSET XYOffset is running 9, SCANSTATAPPROACH Approach is running
quicksave
Parameter : None
Return: None
Function: Saves the current scan file using the default filename. Similar to presisng the Quicksave button
filesave
Parameter : Filename
Return: None
Function: Saves the current scandata file using the filename as .dat file.
fileload
Parameter : Filename
Return: None
Function: Loads a .dat file into the program.
vertsave
Parameter : None
Return: none
Function: save present vertspecdata
Usage: a=stm.vertsave;
latsave
Parameter : None
Return: none
Function: save present latmanipdata
Usage: a=stm.latsave;
savedatfilename
Property String
Parameter : None
Return: None
Function: Read and write the default savefilename of .dat files.
Usage:
filename=stm.savedatfilename;
stm.savefilename=filename;
loadfilename
Property String
Function: Read and write the default loadfilename of .dat files.
Usage:
filename=stm.loaddatfilename;
stm.loadfilename=filename;
savevertfilename
Property String
Function: Read and write the default filename of Vertspec files.
Usage:
filename=stm.savevertfilename;
stm.savevertfilename=filename;
savelatfilename
Property String
Function: Read and write the default filename of Latmanip files.
Usage: filename=stm.savelatfilename;
stm.savelatfilename:=filename;
btn_vertspec
Parameter : 1. xpos :integer 2. ypos :integer
Return: None
Function: Takes a Vert.Spectrum at image point Xpos,Ypos. (Image pixel coordinates as displayed in the status line of the STMAFM main window) Control is returned after the spectrum has been completely finished
Usage: stm.btn_vertspec(128,128);
btn_vertspec_line
Parameter : 1. X coordinate in imagepixels of start point. 2 Y coordinate in imagepixels of start point 3. X coordinate in imagepixels of end point 4. Y coordinate in imagepixels of end point
Return: None Function: Takes a series of Vert.Spectra along a line defined by the start and end image points. (Image pixel coordinates as displayed in the status line of the STMAFM main window) Control is returned after the spectra have been completely finished
Usage:
stm.btn_vertspec_line(50,50,100,100);
btn_vertspec_mult
Parameter : 2d Array of X,Y coordinates 1. X coordinate in imagepixels of 1.point 2. Y coordinate in imagepixels of 1.point .......
2n-1. X coordinate in imagepixels of n.point 2n. Y coordinate in imagepixels of n.point
Return: Ready or Error
Function: Takes a series of Vert.Spectra defined by a list of image points. (Image pixel coordinates as displayed in the status line of the STMAFM main window). Control is returned after the spectra have been completely finished
Usage: a=[10,20;50,50;100,100;19,90]; stm.btn_vertspec_line(a);
btn_tipform
Parameter : 1. xpos :integer 2. ypos :integer
Return: None
Function: Does a tip forming at image point Xpos,Ypos. (Image pixel coordinates as displayed in the status line of the STMAFM main window). Control is returned after the tip forming has been completely finished
Usage: stm.btn_tipform(128,128);
btn_timespec
Parameter : none
Return: None
Function: Takes a time spectrum
Usage: stm.btn_timespec;
scandata
Parameter : channel: integer, units: integer
Return: Array with Scan Channel Data
Function: Read single channel of Scan Data
Usage: a=stm.scandata(channel,unit_volt);
Channels:
1:Topography
2: Current(ADC0)
3: ADC1
4: ADC2
5: ADC3
6: dI/dV
7: d2I/dV
8: df
9: Damping
10: Amplitude
11: CP(DAC1)
12: AUX1
If backward scanning channels are enabled, these channels are accessed by adding 256 as offset to the channel number above.
scandatawrite
Parameter : 1. channel: integer:integer 2. data: Matrix with Scan Channel Data
Return: None
Function: Write single channel of Scan Data
Usage: stm.scandatawrite(channel, data); Presently only DAC units supported
Channels:
1:Topography
2: Current(ADC0)
3: ADC1
4: ADC2
5: ADC3
6: dI/dV
7: d2I/dV
8: df
9: Damping
10: Amplitude
11: CP(DAC1)
12: AUX1
scanauxdata
Property: Matrix with Scan Aux channel Data
Function: Read and write Scan AUX Data channel
Usage:
a=stm.scanauxdata; Presently only DAC units supported
stm.scanauxdata=a;
openscanchannel
Parameter : 1. channel integer 2. select :boolean
Return: none
Function: Activate specific Scan channel
Usage: a=stm.openscanchannel(channel, true);
linescandata
Parameter : None
Return: Array with actual LineScan Data
Function: Read LineScan Data
Linescandata can be transferred into the Matlab workspace in a event driven manner. I.e. click the copy OLE/COM server popupmenue field in the Linescan window. This creates an event in Matlab which starts the serverevents.m file which transfers the data to Matlab.
Columns 1: Distance in Angstrom 2: Y Values
Usage: a=stm.linescandata;
timespecdata
Parameter : channel: integer, units: integer
Return: Vector with Channel Data
Function: Read Channel Data
Columns 1: Channel in units
Usage: a=stm.timespec(3,0);
Channels:
timespecfftdata
Parameter : channel: integer, units: integer
Return: Vector with Channel Data
Function: Read Channel Data
Columns 1: Channel in units
Usage: a=stm.timespec(3,0);
Channels:
latmandata
Parameter : channel: integer, units: integer
Return: Vector with Lat manip Channel Data
Function: Read Lat manip Channel Data
Columns 1: Channel in units
Usage: a=stm.latmandata(channel,units);
Channels: 0: time in sec 1: X 2: Y 3: Current I 4: dI/dV 5: d2I/dV 6: ADC0 7: ADC1 8: ADC2 9: ADC3 10: df 11: Damping 12: Amplitude 13: di_q 14: di2_q 15: Topography(DAC0) 16: CP(DAC1)
Units:
0: Default
1: Volt
2: DAC
3: Ampere
4: nm
5: Hz
vertdata
Parameter : channel: integer, units: integer
Return: Vector with Channel Data
Function: Read Channel Data
Columns 1: Channel in units
Usage: a=stm.vertdata(3,1);
Channels: 0: time in sec 1: V 2: Z 3: Current I 4: dI/dV 5: d2I/dV 6: ADC0 7: ADC1 8: ADC2 9: ADC3 10: df 11: Damping 12: Amplitude 13: di_q 14: di2_q 15: Topography(DAC0) 16: CP(DAC1)
Units:
0: Default
1: Volt
2: DAC
3: Ampere
4: nm
5: Hz
pllspecdata
Parameter : None
Return: Array with PLL Spectrum Scan Data
Function: Read PLL Spectrum Scan Data
Columns 1: Frequency [Hz] 2: Amplitude [a.u.] 3: Phase [Deg]
Usage: a=stm.pllspecdata;
strbuffer
Property
Parameter : None
Return: String with all parameters
Function: Read and write program parameter
Usage:
s=stm.strbuffer;
stm.strbuffer:=s;
pllfreqscan
Parameter : None
Return: none
Function: Start a new PLL Freqeuncy Scan
Usage: a=stm.pllfreqscan;
vertspectrum
Parameter : None
Return: Ready or Error
Function: Takes a Vert.Spectrum at the current image point X,Y. Control is returned after the spectrum has been completely finished The tip remains at the current lateral position (low level command)
move_tip
Parameter : 1. X start position in relative DAC units 2. Y start position in relative DAC units 3. X end position in relative DAC units 4. Y end position in relative DAC units 5. Number steps in which the tip moves from start to endpoint 6 Delay in DSP cycles between each step
Return: None
Function: Move tip to new position. Coordinates are given in relative DAC units (relative: X,Y Offset and rotation are added afterwards) Control is returned after the move has been completely finished
Usage: stm.move_tip(50,50,100,100, 200,100);
move_tip_imagecoord
Parameter : 1. X start position in imagepixels 2. Y start position in imagepixels 3. X end position in imagepixels 4. Y end position in imagepixels 5. Number steps in which the tip moves from start to endpoint 6 Delay in DSP cycles between each step
Return: None
Function: Move tip to new position (Image pixel coordinates as displayed in the status line of the STMAFM main window) Control is returned after the move has been completely finished
Relation between imagepixel coordinates (0<=ximage<nx , 0<=yimage<ny ) and relative DAC coordinates (xdac,ydac): (Top line in image is ny=0)
xdac:=trunc(ximage*dx - (nx div 2)*dx); ydac:=trunc(yimage*dy);
On the DSP a final coordinate transformation is done including rotation, offset and drift correction to calculate the absolute DAC coordinates: Using 20bit DACS the values are internal limited to +/- 524272.
xdacabs= trunc ( - (xdac*rotmxx + ydac*rotmxy + rotoffx-driftxoff)); ydacabs= trunc ( - (xdac*rotmyx + ydac*rotmyy + rotoffy-driftyoff));
Usage: stm.move_tip_imagecoord(50,50,100,100, 200,100);
latmanip
Parameter : 1. X coordinate in imagepixels of start point. 2 Y coordinate in imagepixels of start point 3. X coordinate in imagepixels of end point 4. Y coordinate in imagepixels of end point
Return: None
Function: Takes a lateral manipulation along a line defined by the start and end image points. (Image pixel coordinates as displayed in the status line of the STMAFM main window) Control is returned after the manipulation has been completely finished
Usage: stm.latmanip(50,50,100,100);
latmanipxymove
(low level command)
Parameter : 1. X coordinate of start point in rel. DAC units. 2 Y coordinate of f start point in rel. DAC units. 3. X coordinate of end point in rel. DAC units. 4. Y coordinate of end point in rel. DAC units. 5. Number of steps 6. Delay between steps in DSP Cycles 7. Gain of Preamp during manipulation 8. Bias Voltage during manipulation 9. Current set point during manipulation in constant current mode
Return: None Function: Takes a lateral manipulation along a line defined by the start and end image points. Coordinates are in relative DAC units. Control is returned after the scan has been completely finished.
The recorded data is saved in a file called 'manipxymove.data' placed in the active directory. The file contains one line for each step. For each step the selected number of channels are recorded. (See LATMANIP form)
latmanbufferext
lockinstart
Parameter : None Return: None
Function: Starts the internal lockin amplifier
Usage:
stm.lockinstart;
lockinstop
Parameter : None
Return: None
Function: Stops the internal lockin amplifier
Usage:
stm.lockinstop;
updatedspparam
Parameter: None
Function: Updates all parameters and synchronizes the the parameters with the DSP
Usage:
stm.updatedspparam;
updatedspfbparam
Parameter : None
Return: None
Function: After changing the parameters this command allows to update/synchronize the parameters with the DSP.
For example changing a feedback loop parameter in the old parameter window will not automatically change this parameter on the DSP. Therefore this update command has to be issued afterwards. Allows to set first the new parameters and then update all at the same time on the DSP. (low level command)
sliderup
Parameter : None
Return: None
Function: Moves the slider one step up
Usage:
stm.sliderup;
sliderdown
Parameter : None
Return: None
Function: Moves the slider one step down
Usage:
stm.sliderdown;
slider
Parameter : channel direction
Return: None
Function: Moves the slider
Usage:
stm.slider(1,0);
setdacval
Parameter : board 1..2 channel 0..5 value -524288 .. 524287
Return: None
Function: Sets DAC value of selected channel. Units are DAC Units (20bit)
Usage:
stm.setdacval(1,2,1000);
setdacvalf
Parameter : board 1..2 channel 0..5 value -10.0 .. 10.0
Return: None
Function: Sets DAC value of selected channel. Units are Volt (float)
Usage:
stm.setdacval(1,2,1.034);
getadcval
Parameter : board 1..2 channel 0..5
Return: ADC value of selected channel
Function: Gets the ADC value. Units are in DAC units (20bit) Usage:
stm.getadcval(1,2);
getadcvalf
Parameter : board 1..2 channel 0..5
Return: ADC value of selected channel
Function: Gets the ADC value. Units are in Volt
Usage:
stm.getadcvalf(1,2);
getdacvalfb
Parameter : none
Return: Value of z - Dac in Angstroem
Function: Gets the Feedback DAC Value
Example: a=stm.getdacvalfb;
digoutvalue
Property Integer
Function: Read and write Digital Outputvalue on Board 1
Usage:
i:=stm.digoutvalue;
stm.digoutvalue:=i;
sbcdigoutvalue
Property Integer
Function: Read and write digital outputvalue on SBC6711Board
Usage:
i:=stm.sbcdigoutvalue;
stm.sbcdigoutvalue:=i;
serverneverclose
Parameter: None
Function: If activated makes sure that the STM Program will not close after the connection to the server is stopped, if the STM program was started by the client.
Usage:
stm.serverneverclose;
execmethod
Parameter: Objectname Methodname
Return: None
Function: Execute a specific function in the STM program. Specific debugging use only
Usage:
stm.execmethod('stmafm','Formmemoclick');
setxyoffvolt
Parameter : x: Offset in Volt Range: (-10.0, +10.0) * HVGainX y: Offset in Volt Range: (-10.0, +10.0) * HVGainY
Return: None
Function: Sets a new X_Offset, Y_Offset Value. Units are in Volt
Example: stm.setxyoffsetvolt(12.5,-24.0);
setxyoffpixel
Parameter : x: Offset in Pixel units y: Offset in Pixel Units
Return: None
Function: Sets a new X_Offset, Y_Offset Value. The new offset is given by a pixel position in the present scanimage.
Example: stm.setxypixel(100,78);
scandatabitmap
Parameter : none Return: Array with Scan Channel Bitmap Data
Function: Get the the scanimage data as a bitmap.
The bitmap data is 32bit wide. The bitmap contains all channels.
Example: a=stm.scandatabitmap;
pc32scanstatus
Parameter : none
Return: Scanstatus value on DSP Board
Function: Gets the scanstatus of the DSP program
Example: a=stm.pc32scanstatus;
setchmodezoff
Parameter : zoffset
Return: none
Function: Sets the const height Zoffset value
Example: a=stm.setchmodezoff(1.0);
stmready
Parameter: none Return: stmready 1: ready 0 not ready
Function: If stmready = 1 then the initialization of the STMAFM program is finshed.
Example:
a= stm.stmready;
setrampdspparam
Parameter: zheight: single -10 - + 10V, zduration: single, zburst: integer, xyheight:single, xyduration: single, xyburst: integer
Function: Sets the corresponding parameters of the rampcontroller
Example:
stm.setrampdspparam(1.0,0.01,100,2.0,0.02,200)