1000 !*************************************************
1010 !*
1020 !* FILE       :  CPDIST
1030 !* DESCRIPTION:  Program for Charge Pumping Test
1040 !* AUTHOR     :  Mamoru Aruga,     YHP
1050 !* CREATED    :  Apr. 07, 1995
1060 !* PRODUCT    :  HP4155A,HP4156A
1070 !* REVISION   :  Rev.A.01.00
1080 !*
1090 !*   (c) Copyright 1995, Hewlett-Packard Co,
1100 !*              All rights reserved.
1110 !*
1120 !*
1130 !*  Customer shall have the personal, non-
1140 !* transferable rights to use, copy or modify
1150 !* this SAMPLE PROGRAM for Customer's internal
1160 !* operations.  Customer shall use the SAMPLE
1170 !* PROGRAM solely and exclusively for its own
1180 !* purpose and shall not license, lease, market
1190 !* or distribute the SAMPLE PROGRAM or modification
1200 !* or any part thereof.
1210 !*
1220 !*  HP shall not be liable for the quality,
1230 !* performance or behavior of the SAMPLE PROGRAM.
1240 !* HP especially disclaims that the operation of
1250 !* the SAMPLE PROGRAM shall be uninterrupted or
1260 !* error free.  This SAMPLE PROGRAM is provided
1270 !* AS IS.
1280 !*
1290 !*  HP DISCLAIMS THE IMPLIED WARRANTIES OF
1300 !* MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1310 !* PURPOSE.
1320 !*
1330 !*  HP shall not be liable for any infringement
1340 !* of any patent, trademark, copyright or other
1350 !* proprietary rights by the SAMPLE PROGRAM or
1360 !* its use.  HP does not warrant that the SAMPLE
1370 !* PROGRAM is free from infringements or such
1380 !* rights of third parties.  However, HP will not
1390 !* knowingly infringe or deliver a software that
1400 !* infringes the patent, trademark, copyright or
1410 !* other proprietary right of a third party.
1420 !*
1430 !*************************************************
1440 !
1450  COM @Hp415x,@Form_off,INTEGER Hpib_sc
1460  COM /File_name1/ Setup_file$[12],Save_ascii$[12],Save_data$[12]
1470  COM /Condition1/ REAL Pulse_base,Pulse_peak,Pulse_freq,Peak_hold,Fix_trans
1480  COM /Condition2/ INTEGER No_of_meas
1490  COM /Condition3/ REAL Drain_source_v,Sub_v
1500  COM /Condition4/ REAL Pulse_lead(1:200),Pulse_trail(1:200)
1510  COM /Condition5/ REAL Weff,Leff,T,Vfb,Vt,Cap_cross
1520  COM /Const/ REAL Q,K,Ni,Ei,Nuth
1530  COM /Meas_data/ REAL Icp_lead(1:200),Icp_trail(1:200)
1540  COM /Calc_data/ REAL Nss_lead(1:200),Nss_trail(1:200),Energy_lead(1:200),Energy_trail(1:200)
1550  !
1560  ! ---------- Input Parameters --------------------------------------------
1570  !
1580  ! ---------- HP-IB Setup -------------------------------------------------
1590  INTEGER Hpib_addr,Swm_sc,Swm_addr
1600  !
1610  Hpib_sc=8            ! HP 415X HP-IB Select Code
1620  Hpib_addr=0          ! HP 415X HP-IB Address
1630  !
1640  ASSIGN @Hp415x TO Hpib_sc*100+Hpib_addr
1650  ASSIGN @Form_off TO Hpib_sc*100+Hpib_addr;FORMAT OFF
1660  !
1670  ! ---------- Pulse Voltage Conditions ------------------------------------
1680  Pulse_base=-4        ! Pulse Base Voltage
1690  Pulse_peak=4         ! Pulse Peak Voltage
1700  Pulse_freq=10000.    ! Pulse frequency : 10 kHz. Pulse period :100 usec
1710  Peak_hold=1.E-5      ! Pulse peak hold time 10 usec
1720  Fix_trans=8.E-6      ! Fixed transient time (10% to 90%)
1730  !
1740  ! ---------- Pulse Frequency ---------------------------------------------
1750  No_of_meas=10
1760  REDIM Pulse_lead(1:No_of_meas),Pulse_trail(1:No_of_meas)
1770  REDIM Icp_lead(1:No_of_meas),Icp_trail(1:No_of_meas)
1780  REDIM Nss_lead(2:No_of_meas-1),Nss_trail(2:No_of_meas-1)
1790  REDIM Energy_lead(2:No_of_meas-1),Energy_trail(2:No_of_meas-1)
1800  !
1810 Leading_data:!
1820  DATA 1E-6,2E-6,3E-6,4E-6,5E-6,6E-6,7E-6,8E-6,9E-6,10E-6
1830  DATA 2E-6,4E-6,6E-6,8E-6,10E-6,12E-6,14E-6,16E-6,18E-6,20E-6
1840 Trailing_data:!
1850  DATA 10E-6,9E-6,8E-6,7E-6,6E-6,5E-6,4E-6,3E-6,2E-6,1E-6
1860  DATA 20E-6,18E-6,16E-6,14E-6,12E-6,10E-6,8E-6,6E-6,4E-6,2E-6
1870  !
1880  RESTORE Leading_data
1890  READ Pulse_lead(*)
1900  !
1910  RESTORE Trailing_data
1920  READ Pulse_trail(*)
1930  !
1940  ! ---------- Bais Conditions ---------------------------------------------
1950  Drain_source_v=.5    ! Drain and Source Voltage
1960  Sub_v=0              ! Substrait Voltage
1970  !
1980  ! ---------- Device geometry and temperature -----------------------------
1990  Weff=.005            ! Channel width [cm]
2000  Leff=.0005           ! Channel length [cm]
2010  T=300                ! Temperature [K]
2020  Vfb=-1.3             ! Flat band voltage [V]
2030  Vt=.75               ! Threshold voltage [V]
2040  Cap_cross=5.E-16     ! Capture cross section [cm^-2]
2050  !
2060  ! ---------- Constans ----------------------------------------------------
2070  Q=1.60218E-19    ! Electronic charge [C]
2080  K=8.61738E-5     ! Boltzmann's constant [ev/K]
2090  Ni=1.45E+10      ! Intrinsic carrier concentration of Si at 300 K [cm^-3]
2100  Ei=.56           ! Intrinsic Fermi-level @ 300 K [eV]
2110  Ei=0
2120  Nuth=1.55E+7     ! Thermal verocity of carriers
2130  !
2140  ! ---------- Definition of measurement and stress setup files ------------
2150  !
2160  Setup_file$="SETUP.MES"     ! Charge Pumping Test Setup file
2170  !
2180  ! ---------- File name to save ASCII data --------------------------------
2190  Save_ascii$="CPFD.ASC"     ! Charge Pumping Test Data ASCII file
2200  !
2210  ! ---------- File name to save GRAPHICS data -----------------------------
2220  Save_data$="CPFD.DAT"      ! Charge Pumping Test Data file
2230  !
2240  !///////////////// Main //////////////////////////////////////////////////
2250  !
2260  ON INTR Hpib_sc CALL Err_check   ! Enables HP-IB interrupt
2270  ENABLE INTR Hpib_sc;2
2280  !
2290  CALL Input_param                 ! Input Parameters
2300  CALL Init_hp415x                 ! Initialize HP 415X
2310  CALL Meas_fix_lead            ! Measure Charge Pumping Current
2320  CALL Meas_fix_trail           ! Measure Charge Pumping Current
2330  CALL Graph                       ! Draw Graph of Icp - Pulse Base Voltage
2340  CALL Save_ascii                  ! Save ASCII file
2350  CALL Save_data                   ! Save DAT file
2360  CALL Test_end                    !
2370  DISP "HCI Degradation Test is Completed!!"
2380  !
2390  END
2400  !
2410  !/////////////// Sub //////////////////////////////////////////////
2420 Input_param:SUB Input_param
2430    COM @Hp415x,@Form_off,INTEGER Hpib_sc
2440    COM /File_name1/ Setup_file$,Save_ascii$,Save_data$
2450    COM /Condition1/ REAL Pulse_base,Pulse_peak,Pulse_freq,Peak_hold,Fix_trans
2460    COM /Condition2/ INTEGER No_of_meas
2470    COM /Condition3/ REAL Drain_source_v,Sub_v
2480    COM /Condition4/ REAL Pulse_lead(*),Pulse_trail(*)
2490    COM /Condition5/ REAL Weff,Leff,T,Vfb,Vt,Cap_cross
2500    COM /Const/ REAL Q,K,Ni,Ei,Nuth
2510    COM /Meas_data/ REAL Icp_lead(*),Icp_trail(*)
2520    COM /Calc_data/ REAL Nss_lead(*),Nss_trail(*),Energy_lead(*),Energy_trail(*)
2530    !
2540    CLEAR SCREEN
2550    OUTPUT @Hp415x;":DISP:WIND:ALL BAS"    ! All IBASIC screeen
2560    !
2570    PRINT "Menu to Change Measurement Conditions"
2580    !
2590    PRINT TABXY(2,2);"--------------- File Name -----------------"
2600    PRINT TABXY(2,3);"Setup file name :";Setup_file$
2610    PRINT TABXY(2,4);"ASCII file name to save data :";Save_ascii$
2620    PRINT TABXY(2,5);"DAT file name to save data :";Save_data$
2630    PRINT TABXY(2,10);"----------- Measurement points ------------"
2640    PRINT TABXY(2,7);"Pulse base voltage :";Pulse_base;"[V]"
2650    PRINT TABXY(2,8);"Pulse peak voltage :";Pulse_peak;"[V]"
2660    PRINT TABXY(2,9);"Pulse frequency :";Pulse_freq;"[Hz]"
2670    PRINT TABXY(2,11);"No. of measurement points :";No_of_meas
2680    PRINT TABXY(2,12);"Pulse transient time :";Pulse_lead(*);"[sec]"
2690    PRINT TABXY(2,13);"--------------- SMU Bias -----------------"
2700    PRINT TABXY(2,14);"Drain and Source bais :";Drain_source_v;"[V]"
2710    PRINT TABXY(2,15);"Substrait bais :";Sub_v;"[V]"
2720    PRINT TABXY(2,16);"------ Device parameters & Temperature ------"
2730    PRINT TABXY(2,17);"Channel width :";Weff;"[cm]"
2740    PRINT TABXY(2,18);"Channel length :";Leff;"[cm]"
2750    PRINT TABXY(2,19);"Temperature :";T;"[K]"
2760    PRINT TABXY(2,20);"Flat band voltage :";Vfb;"[V]"
2770    PRINT TABXY(2,21);"Threshold voltage :";Vt;"[V]"
2780    PRINT TABXY(2,22);"Capture cross section :";Cap_cross;"[cm^-2]"
2790    !
2800    ON KEY 1 LABEL "File   Name   ",1 CALL Input_file_name
2810    ON KEY 2 LABEL "Pulse  Voltage",1 CALL Input_pulse_v
2820    ON KEY 3 LABEL "MeasurePoints ",1 CALL Input_meas_pts
2830    ON KEY 4 LABEL "SMU    BIAS   ",1 CALL Input_smu_bias
2840    ON KEY 5 LABEL "Device Parameter",1 CALL Device_geometry
2850    ON KEY 6 LABEL "               ",1 CALL Nop
2860    ON KEY 7 LABEL "Measure        ",1 GOTO End_of_sub
2870    !
2880    LOOP
2890      DISP "Select softkey to change parameters."
2900    END LOOP
2910    !
2920 End_of_sub:!
2930    OFF KEY 
2940    DISP 
2950    CLEAR SCREEN
2960    OUTPUT @Hp415x;":DISP:WIND:ALL BST"    ! IBASIC status screeen
2970  SUBEND
2980  !
2990 Input_file_name:SUB Input_file_name
3000    COM /File_name1/ Setup_file$,Save_ascii$,Save_data$
3010    !
3020    ON KEY 1 LABEL "Setup  File  ",2 GOSUB Setup_file
3030    ON KEY 2 LABEL "ASCII  File  ",2 GOSUB Ascii_file
3040    ON KEY 3 LABEL "DAT    File  ",2 GOSUB Dat_file
3050    ON KEY 4 LABEL "              ",2 CALL Nop
3060    ON KEY 5 LABEL "              ",2 CALL Nop
3070    ON KEY 6 LABEL "              ",2 CALL Nop
3080    ON KEY 7 LABEL "RETURN        ",2 GOTO End_of_sub
3090    LOOP
3100      DISP "Select softkey to change parameter."
3110    END LOOP
3120    !
3130 Setup_file:!
3140    INPUT "Enter setup file name(XXX.MES)",Setup_file$
3150    PRINT TABXY(2,3);"Setup file name :";Setup_file$
3160    RETURN 
3170 Ascii_file:!
3180    INPUT "Enter ASCII data file name",Save_ascii$
3190    PRINT TABXY(2,4);"ASCII file name to save data :";Save_ascii$
3200    RETURN 
3210 Dat_file:!
3220    INPUT "Enter DAT type data file name",Save_data$
3230    PRINT TABXY(2,5);"DAT file name to save data :";Save_data$
3240    RETURN 
3250 End_of_sub:!
3260    OFF KEY 
3270    DISP 
3280  SUBEND
3290  !
3300 Input_pulse_v:SUB Input_pulse_v
3310    COM /Condition1/ REAL Pulse_base,Pulse_peak,Pulse_freq,Peak_hold,Fix_trans
3320    !
3330    ON KEY 1 LABEL "Pulse  Base   Voltage",2 GOSUB Pulse_base
3340    ON KEY 2 LABEL "Pulse  Peak   Voltage",2 GOSUB Pulse_peak
3350    ON KEY 3 LABEL "Pulse  Frequency",2 GOSUB Pulse_freq
3360    ON KEY 4 LABEL "              ",2 CALL Nop
3370    ON KEY 5 LABEL "              ",2 CALL Nop
3380    ON KEY 6 LABEL "              ",2 CALL Nop
3390    ON KEY 7 LABEL "RETURN        ",2 GOTO End_of_sub
3400    LOOP
3410      DISP "Select softkey to change parameter."
3420    END LOOP
3430 Pulse_base:!
3440    INPUT "Enter Pulse Base Voltage [V]",Pulse_base
3450    PRINT TABXY(2,7);"Pulse base voltage :";Pulse_base;"[V]"
3460    RETURN 
3470 Pulse_peak:!
3480    INPUT "Enter Pulse Peak Voltage [V]",Pulse_peak
3490    PRINT TABXY(2,8);"Pulse peak voltage :";Pulse_peak;"[V]"
3500    RETURN 
3510 Pulse_freq:!
3520    PRINT TABXY(2,9);"Pulse frequency :";Pulse_freq;"[Hz]"
3530    RETURN 
3540    !
3550 End_of_sub:!
3560    OFF KEY 
3570    DISP 
3580  SUBEND
3590  !
3600 Input_meas_pts:SUB Input_meas_pts
3610    COM /Condition2/ INTEGER No_of_meas
3620    COM /Condition4/ REAL Pulse_lead(*),Pulse_trail(*)
3630    COM /Meas_data/ REAL Icp_lead(*),Icp_trail(*)
3640    COM /Calc_data/ REAL Nss_lead(*),Nss_trail(*),Energy_lead(*),Energy_trail(*)
3650    !
3660    FOR I=1 TO 7
3670      ON KEY I LABEL "              ",2 CALL Nop
3680    NEXT I
3690    !
3700    INPUT "Enter No. of Measurement Points",No_of_meas
3710    !
3720    REDIM Pulse_lead(1:No_of_meas),Pulse_trail(1:No_of_meas)
3730    REDIM Icp_lead(1:No_of_meas),Icp_trail(1:No_of_meas)
3740    REDIM Nss_lead(2:No_of_meas-1),Nss_trail(2:No_of_meas-1)
3750    REDIM Energy_lead(2:No_of_meas-1),Energy_trail(2:No_of_meas-1)
3760    FOR I=1 TO No_of_meas
3770      PRINT TABXY(1,23);"Enter transient time. Pulse_lead(";I;")&Pulse_trail(";I;")"
3780      INPUT Pulse_lead(I)
3790      Pulse_trail(No_of_meas-I+1)=Pulse_lead(I)
3800    NEXT I
3810    DISP 
3820    PRINT TABXY(1,23);"                                                          "
3830    PRINT TABXY(2,11);"No. of Measurement Points :";No_of_meas
3840    PRINT TABXY(2,12);"Pulse transient time :";Pulse_lead(*);"[sec]"
3850    !
3860    OFF KEY 
3870    !
3880  SUBEND
3890  !
3900 Input_smu_bias:SUB Input_smu_bias
3910    COM /Condition3/ REAL Drain_source_v,Sub_v
3920    !
3930    ON KEY 1 LABEL "Drain   Source Voltage",2 GOSUB D_s_v
3940    ON KEY 2 LABEL "Sub     Voltage",2 GOSUB Sub_v
3950    ON KEY 3 LABEL "              ",2 CALL Nop
3960    ON KEY 4 LABEL "              ",2 CALL Nop
3970    ON KEY 5 LABEL "              ",2 CALL Nop
3980    ON KEY 6 LABEL "              ",2 CALL Nop
3990    ON KEY 7 LABEL "RETURN        ",2 GOTO End_of_sub
4000    LOOP
4010      DISP "Select softkey to change parameter."
4020    END LOOP
4030 D_s_v:   !
4040    INPUT "Enter Drain and Source Voltage [V]",Drain_source_v
4050    PRINT TABXY(2,14);"Drain and Source bais :";Drain_source_v;"[V]"
4060    RETURN 
4070 Sub_v:   !
4080    INPUT "Enter Substrate Voltage [V]",Sub_v
4090    PRINT TABXY(2,15);"Substrait bais :";Sub_v;"[V]"
4100    RETURN 
4110    !
4120 End_of_sub:   !
4130    OFF KEY 
4140    DISP 
4150  SUBEND
4160  !
4170 Device_geometry:SUB Device_geometry
4180    COM /Condition5/ REAL Weff,Leff,T,Vfb,Vt,Cap_cross
4190    !
4200    ON KEY 1 LABEL "Weff          ",2 GOSUB Weff
4210    ON KEY 2 LABEL "Leff          ",2 GOSUB Leff
4220    ON KEY 3 LABEL "Temp          ",2 GOSUB Temp
4230    ON KEY 4 LABEL "Vfb           ",2 GOSUB Vfb
4240    ON KEY 5 LABEL "Vt            ",2 GOSUB Vt
4250    ON KEY 6 LABEL "CaptureCross  Section",2 GOSUB Cap_cross
4260    ON KEY 7 LABEL "RETURN        ",2 GOTO End_of_sub
4270    !
4280    LOOP
4290      DISP "Select softkey to change parameter."
4300    END LOOP
4310 Weff:!
4320    INPUT "Enter effective channel width [cm]",Weff
4330    PRINT TABXY(2,17);"Channel width :";Weff;"[cm]"
4340    RETURN 
4350 Leff:!
4360    INPUT "Enter effective channel length [cm]",Leff
4370    PRINT TABXY(2,18);"Channel length :";Leff;"[cm]"
4380    RETURN 
4390 Temp:!
4400    INPUT "Enter temperature [K]",T
4410    PRINT TABXY(2,19);"Temperature :";T;"[K]"
4420    RETURN 
4430 Vfb:!
4440    INPUT "Enter flat band voltage [V]",Vfb
4450    PRINT TABXY(2,20);"Flat band voltage :";Vfb;"[V]"
4460    RETURN 
4470 Vt:!
4480    INPUT "Enter threshold voltage [V]",Vt
4490    PRINT TABXY(2,21);"Threshold voltage :";Vt;"[V]"
4500    RETURN 
4510 Cap_cross:!
4520    INPUT "Enter capture cross section [cm^-2]",Cap_cross
4530    PRINT TABXY(2,22);"Capture cross section :";Cap_cross;"[cm^-2]"
4540    RETURN 
4550    !
4560 End_of_sub:   !
4570    OFF KEY 
4580    DISP 
4590  SUBEND
4600   !
4610 Nop:SUB Nop
4620  SUBEND
4630  !
4640 Init_hp415x:SUB Init_hp415x
4650    COM @Hp415x,@Form_off,INTEGER Hpib_sc
4660    COM /File_name1/ Setup_file$,Save_ascii$,Save_data$
4670    COM /Condition1/ REAL Pulse_base,Pulse_peak,Pulse_freq,Peak_hold,Fix_trans
4680    COM /Condition3/ REAL Drain_source_v,Sub_v
4690    DIM Comment$[58]
4700    !
4710    CLEAR SCREEN
4720    CLEAR @Hp415x
4730    OUTPUT @Hp415x;"*RST"                  ! Device reset
4740    OUTPUT @Hp415x;"*CLS"                  ! Clear status data
4750    OUTPUT @Hp415x;":STAT:PRES"            ! Preset event enable mask register
4760    OUTPUT @Hp415x;":DISP:WIND:STAT OFF"   ! Screen update off
4770    OUTPUT @Hp415x;":CAL:AUTO OFF"         ! Auto calibration off
4780    OUTPUT @Hp415x;"*ESE 60;*SRE 32;*OPC?" ! Event status/service request enable register setup
4790    ENTER @Hp415x;Complete
4800    OUTPUT @Hp415x;":DISP:WIND:ALL BST"    ! Display IBASIC status screen
4810    !
4820    ! Load setup file, set basi conditions and re-save setup file
4830    !
4840    OUTPUT @Hp415x;":MMEM:LOAD:STAT 0,'"&Setup_file$&"','DISK'"    ! Get setup file
4850    Comment$="Charge Pumping Current Measurement"
4860    OUTPUT @Hp415x;":PAGE:CHAN:COMM '"&Comment$&"'"                ! User omment
4870    CALL Set_pulse_volt                    ! Set pulse voltage
4880    OUTPUT @Hp415x;":PAGE:MEAS:SAMP:CONS:SMU1:SOUR";Drain_source_v ! SMU1 const voltage
4890    OUTPUT @Hp415x;":PAGE:MEAS:SAMP:CONS:SMU4:SOUR";Sub_v          ! SMU4 const voltage
4900    !OUTPUT @Hp415x;":MMEM:DEL '"&Setup_file$&"','DISK',"           ! Purge old setup file
4910    ON ERROR GOTO Error_disp
4920    !OUTPUT @Hp415x;":MMEM:STOR:STAT 0,'"&Setup_file$&"','DISK'"    ! Save new setup file
4930    OFF ERROR 
4940    SUBEXIT
4950 Error_disp:   !
4960    DISP "Setup file was not resaved."
4970    WAIT 3
4980    DISP 
4990    !
5000  SUBEND
5010  !
5020 Meas_fix_lead:SUB Meas_fix_lead
5030    COM @Hp415x,@Form_off,INTEGER Hpib_sc
5040    COM /Condition1/ REAL Pulse_base,Pulse_peak,Pulse_freq,Peak_hold,Fix_trans
5050    COM /Condition2/ INTEGER No_of_meas
5060    COM /Condition4/ REAL Pulse_lead(*),Pulse_trail(*)
5070    COM /Condition5/ REAL Weff,Leff,T,Vfb,Vt,Cap_cross
5080    COM /Const/ REAL Q,K,Ni,Ei,Nuth
5090    COM /Meas_data/ REAL Icp_lead(*),Icp_trail(*)
5100    COM /Calc_data/ REAL Nss_lead(*),Nss_trail(*),Energy_lead(*),Energy_trail(*)
5110    REAL Pulse_period,Pulse_width,Fix_pulse_lead
5120    DIM Comment$[58]
5130    !
5140    Pulse_period=1/Pulse_freq
5150    Pulse_width=Peak_hold+Fix_trans/.8
5160      !
5170    FOR I=1 TO No_of_meas
5180      !
5190      OUTPUT @Hp415x;":DISP:WIND:STAT OFF"   ! Screen update off
5200      Comment$="Icp measurement. Pulse trailing="&VAL$(Pulse_trail(I))&"[sec]"
5210      OUTPUT @Hp415x;":PAGE:CHAN:COMM '"&Comment$&"'"      ! User comment
5220      CALL Set_pulse_time(Pulse_period,Pulse_width,Fix_trans,Pulse_trail(I))
5230      OUTPUT @Hp415x;":PAGE:GLIS:GRAP:MENU"  ! Draw graph
5240      !
5250      ! CALL Pulse_enable
5260      !
5270      OUTPUT @Hp415x;":PAGE:SCON:MEAS:SING"  ! Start sampling measurment
5280      OUTPUT @Hp415x;"*OPC?"                 ! Check completion
5290      ENTER @Hp415x;Complete
5300      OUTPUT @Hp415x;":DISP:WIND:STAT ON"    ! Screen update on
5310      !
5320      ! CALL Pulse_disable
5330      !
5340      OUTPUT @Hp415x;":DATA:DATA? 'Icp'"     ! Transfer ISB
5350      ENTER @Hp415x;Icp_trail(I)
5360      !
5370    NEXT I
5380    !
5390    FOR I=2 TO No_of_meas-1
5400      Energy_trail(I)=Ei-K*T*LOG(Nuth*Cap_cross*Ni*ABS(Vfb-Vt)*Pulse_trail(I)/.8/ABS(Pulse_peak-Pulse_base))
5410      Nss_trail1=-Pulse_trail(I)/(Q*Weff*Leff*K*T*Pulse_freq)
5420      Nss_trail(I)=Nss_trail1*(Icp_trail(I+1)-Icp_trail(I-1))/((Pulse_trail(I+1)-Pulse_trail(I-1))/.8)
5430    NEXT I
5440    !
5450  SUBEND
5460  !
5470 Meas_fix_trail:SUB Meas_fix_trail
5480    COM @Hp415x,@Form_off,INTEGER Hpib_sc
5490    COM /Condition1/ REAL Pulse_base,Pulse_peak,Pulse_freq,Peak_hold,Fix_trans
5500    COM /Condition2/ INTEGER No_of_meas
5510    COM /Condition4/ REAL Pulse_lead(*),Pulse_trail(*)
5520    COM /Condition5/ REAL Weff,Leff,T,Vfb,Vt,Cap_cross
5530    COM /Const/ REAL Q,K,Ni,Ei,Nuth
5540    COM /Meas_data/ REAL Icp_lead(*),Icp_trail(*)
5550    COM /Calc_data/ REAL Nss_lead(*),Nss_trail(*),Energy_lead(*),Energy_trail(*)
5560    REAL Pulse_period,Pulse_width,Fix_pulse_trail
5570    DIM Comment$[58]
5580    !
5590    Pulse_period=1/Pulse_freq
5600      !
5610    FOR I=1 TO No_of_meas
5620    !
5630      Pulse_width=Peak_hold+Pulse_lead(I)/.8
5640      !
5650      OUTPUT @Hp415x;":DISP:WIND:STAT OFF"   ! Screen update off
5660      Comment$="Icp measurement. Pulse leading ="&VAL$(Pulse_lead(I))&"[sec]"
5670      OUTPUT @Hp415x;":PAGE:CHAN:COMM '"&Comment$&"'"      ! User comment
5680      CALL Set_pulse_time(Pulse_period,Pulse_width,Pulse_lead(I),Fix_trans)
5690      OUTPUT @Hp415x;":PAGE:GLIS:GRAP:MENU"  ! Draw graph
5700      !
5710      ! CALL Pulse_enable
5720      !
5730      OUTPUT @Hp415x;":PAGE:SCON:MEAS:SING"  ! Start sampling measurment
5740      OUTPUT @Hp415x;"*OPC?"                 ! Check completion
5750      ENTER @Hp415x;Complete
5760      OUTPUT @Hp415x;":DISP:WIND:STAT ON"    ! Screen update on
5770      !
5780      ! CALL Pulse_disable
5790      !
5800      OUTPUT @Hp415x;":DATA:DATA? 'Icp'"     ! Transfer ISB
5810      ENTER @Hp415x;Icp_lead(I)
5820      !
5830    NEXT I
5840    !
5850    FOR I=2 TO No_of_meas-1
5860      Energy_lead(I)=Ei+K*T*LOG(Nuth*Cap_cross*Ni*ABS(Vfb-Vt)*Pulse_lead(I)/.8/ABS(Pulse_peak-Pulse_base))
5870      Nss_lead1=-Pulse_lead(I)/(Q*Weff*Leff*K*T*Pulse_freq)
5880      Nss_lead(I)=Nss_lead1*(Icp_lead(I+1)-Icp_lead(I-1))/((Pulse_lead(I+1)-Pulse_lead(I-1))/.8)
5890    NEXT I
5900    !
5910  SUBEND
5920  !
5930 Graph:SUB Graph
5940    COM @Hp415x,@Form_off,INTEGER Hpib_sc
5950    COM /Condition2/ INTEGER No_of_meas
5960    COM /Condition5/ REAL Weff,Leff,T,Vfb,Vt,Cap_cross
5970    COM /Const/ REAL Q,K,Ni,Ei,Nuth
5980    COM /Calc_data/ REAL Nss_lead(*),Nss_trail(*),Energy_lead(*),Energy_trail(*)
5990    DIM Comment$[58]
6000    !
6010    ALLOCATE Energy(1:2*(No_of_meas-2))
6020    ALLOCATE Nss_lead_disp(1:2*(No_of_meas-2))
6030    ALLOCATE Nss_trail_disp(1:2*(No_of_meas-2))
6040    !
6050    FOR I=1 TO No_of_meas-2
6060      Energy(I)=Energy_lead(I+1)
6070      Nss_lead_disp(I)=Nss_lead(I+1)
6080      Nss_trail_disp(I)=-MAXREAL
6090    NEXT I
6100    !
6110    FOR I=No_of_meas-1 TO 2*(No_of_meas-2)
6120      Energy(I)=Energy_trail(I-(No_of_meas-1)+2)
6130      Nss_lead_disp(I)=-MAXREAL
6140      Nss_trail_disp(I)=Nss_trail(I-(No_of_meas-1)+2)
6150    NEXT I
6160    !
6170    OUTPUT @Hp415x;":DISP:WIND:STAT OFF"            ! Screen update off
6180    !
6190    Comment$="Surface states(Nss)vs Energy(eV)"
6200    OUTPUT @Hp415x;":PAGE:CHAN:COMM '"&Comment$&"'" ! Set user comment
6210    !
6220    OUTPUT @Hp415x;":TRAC:DEL:ALL"                  ! Delete all user variable names
6230    OUTPUT @Hp415x;":TRAC:DEF 'Energy',";2*(No_of_meas-2) ! Define user variable
6240    OUTPUT @Hp415x;":TRAC:UNIT 'Energy','eV'"             ! 'Energy'
6250    OUTPUT @Hp415x;":TRAC:DEF 'Nss1',";2*(No_of_meas-2)   ! Define user variable
6260    OUTPUT @Hp415x;":TRAC:UNIT 'Nss1',' '"                ! 'Nss1' = Nss_lead
6270    OUTPUT @Hp415x;":TRAC:DEF 'Nss2',";2*(No_of_meas-2)   ! Define user variable
6280    OUTPUT @Hp415x;":TRAC:UNIT 'Nss2',' '"                ! 'Nss2' = Nss_trail
6290    !
6300    OUTPUT @Hp415x;":FORM:DATA REAL,64"             ! Binary data transfer
6310    OUTPUT @Hp415x;":FORM:BORD NORM"                ! Transfer in normal mode
6320    OUTPUT @Hp415x;":TRAC 'Energy',#0";             ! Transfer Energy
6330    OUTPUT @Form_off;Energy(*),END
6340    OUTPUT @Hp415x;":TRAC 'Nss1',#0";               ! Transfer Nss_lead
6350    OUTPUT @Form_off;Nss_lead_disp(*),END
6360    OUTPUT @Hp415x;":TRAC 'Nss2',#0";               ! Transfer Nss_trail
6370    OUTPUT @Form_off;Nss_trail_disp(*),END
6380    OUTPUT @Hp415x;":FORM:DATA ASCII"               ! ASCII data transfer
6390    !
6400    OUTPUT @Hp415x;":PAGE:DISP:GRAP:X:NAME 'Energy'"! Set X axis to Energy
6410    OUTPUT @Hp415x;":PAGE:DISP:GRAP:Y1:NAME 'Nss1'" ! Set Y1 axis to Nss_lead
6420    OUTPUT @Hp415x;":PAGE:DISP:GRAP:Y2:NAME 'Nss2'" ! Set Y2 axis to Qss_trail
6430    OUTPUT @Hp415x;":PAGE:DISP:GRAP:X:SCAL LIN"     ! X axis Linear scale
6440    OUTPUT @Hp415x;":PAGE:DISP:GRAP:Y1:SCAL LIN"    ! Y1 axis Linear scale
6450    OUTPUT @Hp415x;":PAGE:DISP:GRAP:Y2:SCAL LIN"    ! Y2 axis Linear scale
6460    OUTPUT @Hp415x;":PAGE:DISP:SET:GRAP:X:MAX ";1.2*MAX(Energy(*))
6470    OUTPUT @Hp415x;":PAGE:DISP:SET:GRAP:X:MIN ";1.2*MIN(Energy(*))
6480    Max1=MAX(Nss_lead_disp(*))
6490    Max2=MAX(Nss_trail_disp(*))
6500    OUTPUT @Hp415x;":PAGE:DISP:SET:GRAP:Y1:MAX ";MAX(Max1,Max2)
6510    OUTPUT @Hp415x;":PAGE:DISP:SET:GRAP:Y2:MAX ";MAX(Max1,Max2)
6520    OUTPUT @Hp415x;":PAGE:DISP:SET:GRAP:Y1:MIN ";0  ! Y1 Min = 0
6530    OUTPUT @Hp415x;":PAGE:DISP:SET:GRAP:Y2:MIN ";0  ! Y2 Min = 0
6540    OUTPUT @Hp415x;":PAGE:DISP:SET:DVAR:DEL:ALL"
6550    OUTPUT @Hp415x;":PAGE:DISP:ANAL:LINE:MODE DIS"
6560    OUTPUT @Hp415x;":PAGE:GLIS:GRAP:MARK:STAT ON"   ! Marker on
6570    !
6580    OUTPUT @Hp415x;":DISP:WIND:STAT ON"             ! Screen update on
6590    OUTPUT @Hp415x;":DISP:WIND:STAT OFF"            ! Screen update off
6600    !
6610  SUBEND
6620  !
6630 Save_ascii:SUB Save_ascii
6640    COM @Hp415x,@Form_off,INTEGER Hpib_sc
6650    COM /File_name1/ Setup_file$,Save_ascii$,Save_data$
6660    COM /Condition1/ REAL Pulse_base,Pulse_peak,Pulse_freq,Peak_hold,Fix_trans
6670    COM /Condition2/ INTEGER No_of_meas
6680    COM /Condition3/ REAL Drain_source_v,Sub_v
6690    COM /Condition4/ REAL Pulse_lead(*),Pulse_trail(*)
6700    COM /Condition5/ REAL Weff,Leff,T,Vfb,Vt,Cap_cross
6710    COM /Const/ REAL Q,K,Ni,Ei,Nuth
6720    COM /Meas_data/ REAL Icp_lead(*),Icp_trail(*)
6730    COM /Calc_data/ REAL Nss_lead(*),Nss_trail(*),Energy_lead(*),Energy_trail(*)
6740    ! ---------- Create charge pumping data to ASCII file ------------------
6750    ON ERROR GOSUB Error
6760    CREATE Save_ascii$,100
6770    OFF ERROR 
6780    ASSIGN @File TO Save_ascii$;FORMAT ON
6790    OUTPUT @File;No_of_meas
6800    OUTPUT @File;Pulse_base,Pulse_peak,Pulse_freq,Peak_hold,Fix_trans
6810    OUTPUT @File;Drain_source_v,Sub_v
6820    OUTPUT @File;Weff,Leff,T,Vfb,Vt,Cap_cross
6830    OUTPUT @File;Pulse_lead(*)
6840    OUTPUT @File;Pulse_trail(*)
6850    OUTPUT @File;Icp_lead(*)
6860    OUTPUT @File;Icp_trail(*)
6870    OUTPUT @File;Nss_lead(*)
6880    OUTPUT @File;Nss_trail(*)
6890    OUTPUT @File;Energy_lead(*)
6900    OUTPUT @File;Energy_trail(*)
6910    ASSIGN @File TO *
6920    SUBEXIT
6930    !
6940 Error:   !
6950    !
6960    OUTPUT @Hp415x;":DISP:WIND:STAT ON"    ! Screen update on
6970    OUTPUT @Hp415x;":DISP:WIND:ALL BAS"    ! All IBASIC screen
6980    IF ERRN=56 THEN 
6990      PRINT "Old";Save_sacii$;"exists. Rename old file and press [Continue]."
7000    ELSE
7010      PRINT ERRM$
7020      PRINT "Take measure(s) to prevent the error and press [Continue]."
7030    END IF
7040    PAUSE
7050    !
7060    CLEAR SCREEN
7070    OUTPUT @Hp415x;":DISP:WIND:ALL BST"    ! Display IBASIC status screen
7080    RETURN 
7090    !
7100  SUBEND
7110  !
7120 Save_data:SUB Save_data
7130    COM @Hp415x,@Form_off,INTEGER Hpib_sc
7140    COM /File_name1/ Setup_file$,Save_ascii$,Save_data$
7150    ! ----------- Save charge pumping data to DAT file ---------------------
7160    ON ERROR GOSUB Error
7170    OUTPUT @Hp415x;":MMEM:STOR:TRAC DEF,'"&Save_data$&"','DISK'"
7180    OFF ERROR 
7190    SUBEXIT
7200    !
7210 Error:   !
7220    !
7230    OUTPUT @Hp415x;":DISP:WIND:STAT ON"    ! Screen update on
7240    OUTPUT @Hp415x;":DISP:WIND:ALL BAS"    ! All IBASIC screen
7250    IF ERRN=56 THEN 
7260      PRINT "Old";Save_file$;"exists. Rename old file and press [Continue]."
7270    ELSE
7280      PRINT ERRM$
7290      PRINT "Take measure(s) to prevent the error and press [Continue]."
7300    END IF
7310    PAUSE
7320    !
7330    CLEAR SCREEN
7340    OUTPUT @Hp415x;":DISP:WIND:ALL BST"    ! Display IBASIC status screen
7350    RETURN 
7360    !
7370  SUBEND
7380    !
7390 Test_end:SUB Test_end
7400    COM @Hp415x,@Form_off,INTEGER Hpib_sc
7410    !
7420    OUTPUT @Hp415x;"*CLS"                  ! Clear status data
7430    OUTPUT @Hp415x;":DISP:WIND:STAT ON"    ! Screen update on
7440    OUTPUT @Hp415x;":DISP:WIND:ALL INST"   ! All instrument screen
7450    !
7460  SUBEND
7470    !
7480 Err_check:SUB Err_check
7490    COM @Hp415x,@Form_off,INTEGER Hpib_sc
7500    !
7510    INTEGER I,J
7511    DIM Err_message$(10)[100]
7520    !
7530    OUTPUT @Hp415x;":PAGE:SCON:STOP"       ! Stop measurement
7540    I=0
7550    REPEAT
7560      I=I+1
7570      OUTPUT @Hp415x;":SYST:ERR?"          ! Read error
7580      ENTER @Hp415x;Err_num(I),Err_message$(I)
7590    UNTIL Err_num(I)=0
7600    IF I=1 THEN 
7610      PRINT "No Error"
7620    ELSE
7630      PRINT 
7640      PRINT 
7650      PRINT "### ERROR Occurred ###:"
7660      FOR J=1 TO I-1
7670        PRINT Err_num(J);Err_message$(J)
7680      NEXT J
7690      OUTPUT @Hp415x;":DISP:WIND:STAT ON"  ! Screen update on
7700      OUTPUT @Hp415x;":DISP:WIND:ALL BAS"  ! All IBASIC screen
7710      PRINT 
7720      PRINT "              === Test Aborted ==="
7730      STOP
7740    END IF
7750  SUBEND
7760  !
7770 Set_pulse_time:SUB Set_pulse_time(Pulse_period,Pulse_width,Pulse_lead,Pulse_trail)
7780    COM @Hp415x,@Form_off,INTEGER Hpib_sc
7790    !
7800    OUTPUT @Hp415x;":PAGE:MEAS:PGUS:PULS:PGU1:PER";Pulse_period
7810    OUTPUT @Hp415x;":PAGE:MEAS:PGUS:PULS:PGU1:WIDT";Pulse_width
7820    OUTPUT @Hp415x;":PAGE:MEAS:PGUS:PULS:PGU1:LEAD";Pulse_lead
7830    OUTPUT @Hp415x;":PAGE:MEAS:PGUS:PULS:PGU1:TRA";Pulse_trail
7840  SUBEND
7850  !
7860 Set_pulse_volt:SUB Set_pulse_volt
7870    COM @Hp415x,@Form_off,INTEGER Hpib_sc
7880    COM /Condition1/ REAL Pulse_base,Pulse_peak,Pulse_freq,Peak_hold,Fix_trans
7890    !
7900    OUTPUT @Hp415x;":PAGE:MEAS:PGUS:PULS:PGU1:PEAK ";Pulse_peak    ! PGU1 pulse peak voltage
7910    OUTPUT @Hp415x;":PAGE:MEAS:PGUS:PULS:PGU1:BASE ";Pulse_base    ! PGU1 pulse base voltage
7920  SUBEND
7930  !
7940 Pulse_enable:SUB Pulse_enable   ! This subprogram is used to enable
7950  ! external pulse generator output
7960  ! OUTPUT Ext_pg;"ENABLE COMMAND"
7970  !
7980  SUBEND
7990 Pulse_disable:SUB Pulse_disable   ! This subprogram is used to disable
8000  ! external pulse generator output
8010  ! OUTPUT Ext_pg;"DISABLE COMMAND"
8020  !
8030  SUBEND
