00001 /* Gnome gxsm - Gnome X Scanning Microscopy 00002 * universal STM/AFM/SARLS/SPALEED/... controlling and 00003 * data analysis software 00004 * 00005 * Gxsm Plugin Name: DSPProbe.C 00006 * ======================================== 00007 * 00008 * Copyright (C) 1999 The Free Software Foundation 00009 * 00010 * Authors: Percy Zahl <zahl@fkp.uni-hannover.de> 00011 * additional features: Andreas Klust <klust@fkp.uni-hannover.de> 00012 * 00013 * This program is free software; you can redistribute it and/or modify 00014 * it under the terms of the GNU General Public License as published by 00015 * the Free Software Foundation; either version 2 of the License, or 00016 * (at your option) any later version. 00017 * 00018 * This program is distributed in the hope that it will be useful, 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 * GNU General Public License for more details. 00022 * 00023 * You should have received a copy of the GNU General Public License 00024 * along with this program; if not, write to the Free Software 00025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 00026 */ 00027 00028 00029 /* Please do not change the Begin/End lines of this comment section! 00030 * this is a LaTeX style section used for auto generation of the PlugIn Manual 00031 * Chapter. Add a complete PlugIn documentation inbetween the Begin/End marks! 00032 * All "% PlugInXXX" commentary tags are mandatory 00033 * All "% OptPlugInXXX" tags are optional 00034 * -------------------------------------------------------------------------------- 00035 % PlugInModuleIgnore 00036 00037 % BeginPlugInDocuSection 00038 % PlugInDocuCaption: Digital probing -- STS and more (OBSOLETE) 00039 % PlugInName: DSPProbe 00040 % PlugInAuthor: Percy Zahl 00041 % PlugInAuthorEmail: zahl@users.sf.net 00042 % PlugInMenuPath: Windows/DSP Probe 00043 00044 % PlugInDescription 00045 This control provides the user frontend for all local probing 00046 methods, e.g. STS and Force-Distance curves. The probe modes are 00047 highly configurable via \GxsmPref{Probe}{Probe/ModeNxxx} and need to 00048 be configured before any probing is possible. There are up to four 00049 individual probe modes configurable, they will appear as folders in 00050 the probe control window, see configuration below. 00051 00052 Each folder works independent and stores/restores all parameters at 00053 folder close/reopen. The probeing parameters itself are set and the 00054 probe process can be started via pressing the button \GxsmEmph{Start}. 00055 00056 \GxsmScreenShot{ProbeControl-STS}{The Probe Control window, STS folder.} 00057 00058 00059 % PlugInUsage 00060 Let's try a simple IV-curve: Assuming the configuration is done right, 00061 the corresponding IV curve folder has to be selected first. It is also 00062 assumed the instrument is in a stable tunneling condition, say 00063 U$=2\:$V and I$=1\:$nA. It is usually a good idea to start the probing 00064 close or at the current voltage set to avoid a quick voltage change in 00065 the beginning of the probing process. So set \GxsmEmph{Range: Start} 00066 to $2\:$V and \GxsmEmph{End} to $-2\:$V.\\ 00067 \GxsmNote{The probing is always started at the start voltage and is 00068 linear ramped to the end voltage and will ramp from negative to 00069 positive as well, if set this way.}\\ 00070 Set the number of \GxsmEmph{Points} to acquire to 1000 and the number 00071 of samples to be averaged \GxsmEmph{\#Avg} to 33 for example. Using 00072 \GxsmEmph{Delay} the probing can be slowed down. It takes about 00073 $50000\:$samples/s, depending on the current DSP program version 00074 running. 00075 00076 Let \GxsmEmph{AC, Frq, Phase, CI} at zero for normal probing and do 00077 not care about \GxsmEmph{GapAdj, \#Ch, ACMult}. The digital Lock-In is 00078 used if \GxsmEmph{AC, Frq} are non zero, \GxsmEmph{Phase} sets the 00079 Lock-In phase relative to the modulation signal. 00080 00081 Press \GxsmEmph{Start}! The result will be shown in the 00082 \GxsmEmph{Profile-View} (\ref{Gxsm-Profile}). 00083 00084 \GxsmScreenShot{ProbeControl-STS-AC}{The Probe Control window, STS-AC folder.} 00085 00086 \def\overlap{8} 00087 \def\smpsin{128} 00088 00089 The digital Lock-In (AC-mode) can be used with the new DSP software 00090 (xsm.out, starting with V1.19) version only. 00091 To use the AC/Lock-In mode the AC parameters \GxsmEmph{AC, Frq, Phase, ACMult} 00092 have to be specified and \GxsmEmph{AC, Frq} have to be non zero. Set \GxsmEmph{ACMult} to 1. 00093 \GxsmEmph{\#Ave} specifies the number of periods 00094 (\smpsin\ samples/per period) to be used for integration inbetween data 00095 points (\GxsmEmph{Points}). 00096 A fixed number of \overlap\ (defined in \GxsmFile{xsm/xsm\_conf.h}) 00097 overlaping sections (overlapping Lock-In data window) of length 00098 of \GxsmEmph{\#Ave} periods is used for integration of the correlation function. 00099 Thus the total integration length (time constant $\tau$) is 00100 \[ \tau = \frac{\text{Ave} \cdot \text{\overlap}}{\text{Frq}}. \] 00101 00102 The \GxsmEmph{AC: Amp} is the modulation amplitude, 00103 \GxsmEmph{Frq} is the modulation frequency (up to $1100\:$Hz). If the 00104 \GxsmEmph{Phase} is given the digital Lock-In uses it for phase shifting the 00105 internal reference signal. 00106 00107 Lock-In calculation: 00108 \[ N = \smpsin \cdot \text{Ave} \cdot \text{\overlap} \] 00109 \[ \omega = 2 \pi \cdot \text{Frq} \] 00110 \[ U_{\text{ref}} = \text{Amp} \cdot \sin(\omega t_i) \] 00111 \[ U_{\text{out}} = \frac{2\pi}{N} \sum_{i=0 \dots N-1} \text{Amp} \cdot U_{\text{in},i} \cdot \sin(i \frac{2 \pi}{\smpsin} + \text{Phase}) \] 00112 00113 \GxsmNote{The phase resolution depends on samples/period and is $\frac{360}{\smpsin}^\circ$.} 00114 00115 \GxsmNote{If you need more resolution than the DAC provides, you can make use of statistically noise, 00116 which gives more resolution with increased integration/korrelation length and set the \GxsmEmph{ACMult} 00117 to about 10 get one magnitude more (this scales the data for transfer only, and it is corrected afterwards).} 00118 00119 00120 %% OptPlugInSection: replace this by the section caption 00121 00122 %% OptPlugInSubSection: replace this line by the subsection caption 00123 00124 % OptPlugInConfig 00125 The \GxsmPref{Probe}{Probe/\dots} offers a sophisticated probe setup, 00126 the Mode1 entries of the preferences folder is shown here. 00127 \GxsmScreenShot{PrefProbe}{The Probe Preference folder.} 00128 00129 For each mode \GxsmEmph{Mode$N$, $N\in\{1,2,3,4\}$} the following 00130 settings have to be provided: 00131 00132 \begin{description} 00133 \item[Name] This mode name appears as folder label of the probe 00134 control. If the name is just a dash (``-'') this mode will be 00135 disabled and does not show up as folder. 00136 \item[Id] This id is used for identifying and files suffixes, it has to be 00137 alpha-numeric and without white spaces or special symbols. It should 00138 be as short as possible, but unique, such as ``IV''. 00139 \item[Param] A descriptive folder caption text for this mode. 00140 \item[Srcs] Configuration of data sources to be acquired. It is given 00141 in a binay representation: 4 binary digits (0/1) for PID sources 00142 (ADC1,2,3,4) 00143 and 8 digits for data input (ADC1,2,3,4, 5,6,7,8). (5\dots8 PC31 only)\\ 00144 and 2 additional digits for additional DSP calculated data\\ 00145 Example: ``10001000000010'' Feedback (I) on ADC1, probe data input is 00146 also ADC1 and one additional DSP calculated data set is expected 00147 (e.g. avgeraged signal from LockIn Src). 00148 \item[Outp] Configuration of DAC channel used for probe X-signal 00149 output, enter the a DAC number (DAC1=0, DAC2=1, DAC3=2, DAC4=3). 00150 \item[XUnit] Select the physical X unit, typically ``V'' (Volts). 00151 \item[XLabel] Give a short label for the X axis. 00152 \item[XFactor] Configure a factor for calculation of the value in 00153 physical from digital units. Example: For a 16 bit DAC with 00154 $\pm10\:$V range (as used with the PCI32) a factor of 3276.7 will 00155 correctly convert from volts to digital units. 00156 \item[XOffset] Usually zero, but could be used for corrections or 00157 adjustments. Fill in the correction value in physical units. 00158 \item[YUnit] Select the physical Y unit, typically ``V'' (Volts) or ``nA''. 00159 \item[YLabel] Give a short label for the Y axis. 00160 \item[YFactor] Similar to the \GxsmEmph{XFactor}. 00161 \item[YOffset] Similar to the \GxsmEmph{XOffset}. 00162 \end{description} 00163 00164 00165 % OptPlugInFiles 00166 You can save the data as Ascii, as described in the profile section (\ref{Gxsm-Profile}). 00167 00168 %% OptPlugInKnownBugs 00169 00170 %% OptPlugInRefs 00171 %The internal used fast fourier transform is based on the FFTW library:\\ 00172 %\GxsmWebLink{www.fftw.org}\\ 00173 %Especially here:\\ 00174 %\GxsmWebLink{www.fftw.org/doc/fftw\_2.html\#SEC5} 00175 00176 % OptPlugInNotes 00177 The \GxsmEmph{Stop} button has no function at all.\\ 00178 00179 % OptPlugInNotes 00180 Depending on configured data exchange type (DSP software level, select 00181 short or float) the maximum number of data points is limited to a 00182 total size of of 3400 shorts:\\[1mm] 00183 \begin{tabular}{l|r|r} 00184 \# Channels & max \# short points & max \# float points \\\hline 00185 1 & 3400 & 1700 \\ 00186 2 & 1700 & 850 \\ 00187 \end{tabular}\\[1mm] 00188 The dialog is not restricting the number of points, but you won't get 00189 any result if the number entered is to big. 00190 00191 %% OptPlugInHints 00192 %I have still a lot more\dots 00193 00194 % EndPlugInDocuSection 00195 * -------------------------------------------------------------------------------- 00196 */ 00197 00198 00199 #include "app_probe.h" 00200 00201 static void DSPProbe_about( void ); 00202 static void DSPProbe_query( void ); 00203 static void DSPProbe_cleanup( void ); 00204 static void DSPProbe_configure( void ); 00205 00206 static void DSPProbe_show_callback( GtkWidget*, void* ); 00207 00208 GxsmPlugin DSPProbe_pi = { 00209 NULL, 00210 NULL, 00211 0, 00212 NULL, 00213 "DSPProbe", 00214 "+spmHARD +comedispmHARD +srangerspmHARD +STM +AFM", 00215 NULL, 00216 "Percy Zahl", 00217 N_("_Windows/"), 00218 N_("DSP Probe"), 00219 N_("open the DSP probe controlwindow"), 00220 "DSP probe control", 00221 NULL, 00222 NULL, 00223 NULL, 00224 DSPProbe_query, 00225 DSPProbe_about, 00226 DSPProbe_configure, 00227 NULL, 00228 DSPProbe_cleanup 00229 }; 00230 00231 static const char *about_text = N_("Gxsm DSPProbe Plugin:\n" 00232 "This plugin runs a controls window to send " 00233 "general \"Probe-Requests\" to the DSP. " 00234 "Probemodes are used to run force-distance curves " 00235 "(AFM), or some STS (STM)." 00236 ); 00237 00238 GxsmPlugin *get_gxsm_plugin_info ( void ){ 00239 DSPProbe_pi.description = g_strdup_printf(N_("Gxsm DSPProbe plugin %s"), VERSION); 00240 return &DSPProbe_pi; 00241 } 00242 00243 static void DSPProbe_configure( void ) 00244 { 00245 // if( DSPProbeClass ) 00246 // DSPProbeClass->configure() 00247 } 00248 00249 00250 DSPProbeControl *DSPProbeClass = NULL; 00251 00252 static void DSPProbe_query(void) 00253 { 00254 static GnomeUIInfo menuinfo[] = { 00255 { GNOME_APP_UI_ITEM, 00256 DSPProbe_pi.menuentry, DSPProbe_pi.help, 00257 (gpointer) DSPProbe_show_callback, NULL, 00258 NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_BLANK, 00259 0, GDK_CONTROL_MASK, NULL }, 00260 00261 GNOMEUIINFO_END 00262 }; 00263 00264 gnome_app_insert_menus(GNOME_APP(DSPProbe_pi.app->getApp()), DSPProbe_pi.menupath, menuinfo); 00265 00266 // new ... 00267 00268 DSPProbeClass = new DSPProbeControl 00269 ( DSPProbe_pi.app->xsm->hardware, 00270 & DSPProbe_pi.app->RemoteEntryList 00271 ); 00272 00273 DSPProbeClass->SetResName ("WindowProbeControl", "false", xsmres.geomsave); 00274 00275 // DSPProbe_pi.app->ConnectPluginToStartScanEvent 00276 // ( DSPProbe_StartScan_callback ); 00277 00278 if(DSPProbe_pi.status) g_free(DSPProbe_pi.status); 00279 DSPProbe_pi.status = g_strconcat(N_("Plugin query has attached "), 00280 DSPProbe_pi.name, 00281 N_(": DSPProbe is created."), 00282 NULL); 00283 } 00284 00285 static void DSPProbe_about(void) 00286 { 00287 const gchar *authors[] = { "Percy Zahl", NULL}; 00288 gtk_widget_show(gnome_about_new ( DSPProbe_pi.name, 00289 VERSION, 00290 N_("(C) 2000 the Free Software Foundation"), 00291 about_text, 00292 authors, 00293 NULL, NULL, NULL 00294 )); 00295 } 00296 00297 static void DSPProbe_cleanup( void ){ 00298 PI_DEBUG (DBG_L2, "DSPProbe Plugin Cleanup: removing MenuEntry" ); 00299 gchar *mp = g_strconcat(DSPProbe_pi.menupath, DSPProbe_pi.menuentry, NULL); 00300 gnome_app_remove_menus (GNOME_APP( DSPProbe_pi.app->getApp() ), mp, 1); 00301 g_free(mp); 00302 00303 PI_DEBUG (DBG_L2, "DSPProbe Plugin Cleanup: Window" ); 00304 // delete ... 00305 if( DSPProbeClass ) 00306 delete DSPProbeClass ; 00307 00308 DSPProbeClass = NULL; 00309 PI_DEBUG (DBG_L2, "DSPProbe Plugin Cleanup: done." ); 00310 } 00311 00312 static void DSPProbe_show_callback( GtkWidget* widget, void* data){ 00313 if( DSPProbeClass ) 00314 DSPProbeClass->show(); 00315 }