让我们看两个典型命令:
node[1].smua.source.func = node[1].smua.OUTPUT _ DCVOLTS
node[1].smua.source.levelv = 0
脚本语言运行使用别名,这可能使代码更可读,并改进代码执行速度。我们为DAC测试示例定义了以下别名:
MASTER = node[1] --Alias indicating control is via Node 1
SLAVE = node[2] --Node 2 is controlled by MASTER via TSP-Link
IOUT1 = MASTER.smua --Alias for SMU measuring current output #1
--IOUT1 is equivalent to node[1].smua
IOUT2 = MASTER.smub --Alias for SMU measuring current output #2
--IOUT2 is equivalent to node[1].smub
DIO = MASTER.digio --Alias for Digital I/O of 2602 #1
--DIO is equivalent to node[1].digio
VPLUS = SLAVE.smua --Alias for SMU supplying V+ and measuring current draw
--VPLUS is equivalent to node[2].smua
VREF = SLAVE.smub --Alias for SMU supplying reference voltage (Vref)
--VREF is equivalent to node[2].smub
在整个示例中都使用了别名。利用定义的别名,示例命令可以重写为:
IOUT1.source.func = IOUT1.OUTPUT_DCVOLTS
IOUT1.source.levelv = 0
通常,脚本语言[3]不需要明确变量。根据对其的赋值,它们被声明和定义为定义“on the fly”。但表格(也就是数组)除外, 它们必须定义数据类型定义数据类型。所有变量都是全局的,除非明确声明为本地的。在代码片段出现以下“常数”:
Vref = 10 --Use +10VDC reference voltage
IoutMax = 0.002 --Max expected current output
Nplc = 0.001 --Integration time for SMU A-to-D converters (in terms of power line cycles)
Nbits = 8 --Number of DAC control bits (digital inputs)
Ncodes = 2^Nbits --Number of possible control codes
MaxCode = Ncodes - 1 --Decimal equivalent of full-scale code (255 for 8-bit DAC)
Lsb = Vref / MaxCode --Nominal value of least significant bit
在开始实际测试序列之前,一般要对仪器进行某些初始设置。在我们的示例中,初始设置包括设置源函数及范围、测量函数及范围、电压检测模式等等。所有这4个源-测量单元[4]的配置都是类似的。对于节点1的SMU A,某些设置命令如下:
MASTER.reset() --Reset all Node 1 logical instruments to default settings
IOUT1.sense = IOUT1.SENSE_REMOTE --Use REMOTE (4-wire) voltage sensing
IOUT1.source.func = IOUT1.OUTPUT_DCVOLTS --Configure SMU to source DCV
IOUT1.source.rangev = 0 --Set voltage source ranges;
--2602 picks appropriate range based on programmed value
IOUT1.source.levelv = 0 --To measure current, source zero volts on lowest range
IOUT1.source.limiti = 1.2 * IoutMax --Set current compliance limit (20% over max)
IOUT1.measure.nplc = Nplc --Set integration times for all measurements
IOUT1.measure.autozero = IOUT1.AUTOZERO_AUTO --Autozero for max accuracy;
IOUT1.measure.rangei = IoutMax --Set up current measurement range; Measurement
--range for source function fixed at source range val
IOUT1.measure.filter.type = IOUT1.FILTER_REPEAT_AVG --Use REPEAT filter
IOUT1.measure.filter.count = 5 --Reading will be average of 5 consecutive measurements
IOUT1.measure.filter.enable = IOUT1.FILTER_ON --Enable Node 1 SMU A digital filter
--Set measurement parameters the 2602s will display (if display is enabled)
--Displays can be disabled to improve test speed
MASTER.display.screen = MASTER.display.SMUA_SMUB --Digital port isn’t affected by reset so user must set desired initial state
DIO.writeport(0) --Set all digital control bits to zero
DIO.writeprotect(16128) --Write protect bits 9 through 14, which are reserved for
--component handler control in this example.