1000 !*************************************************
1010 !*
1020 !* FILE       :  NOR_TEST
1030 !* DESCRIPTION:  Program for NOR-FLASH ROM Stress Test.
1040 !*
1080 !* PRODUCT    :  4155,4156
1090 !* REVISION   :  Rev.A.01.11
1100 !*
1100 !*   (c) Copyright Agilent Technologies 1994
1120 !*              All rights reserved.
1130 !*
1140 !*
1150 !*  Customer shall have the personal, non-
1160 !* transferable right to use, copy or modify
1170 !* this SAMPLE PROGRAM for Customer's internal
1180 !* operations.  Customer shall use the SAMPLE
1190 !* PROGRAM solely and exclusively for its own
1200 !* purpose and shall not license, lease, market
1210 !* or distribute the SAMPLE PROGRAM or modification
1220 !* or any part thereof.
1230 !*
1240 !*  Agilent shall not be liable for the quality,
1250 !* performance or behavior of the SAMPLE PROGRAM.
1260 !* Agilent especially disclaims that the operation
1270 !* of the SAMPLE PROGRAM shall be uninterrupted or
1280 !* error free.  This SAMPLE PROGRAM is provided
1290 !* AS IS.
1300 !*
1310 !*  AGILENT DISCLAIMS THE IMPLIED WARRANTIES OF
1320 !* MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1330 !* PURPOSE.
1340 !*
1350 !*  Agilent shall not be liable for any infringement
1360 !* of any patent, trademark copyright or other
1370 !* proprietary rights by the SAMPLE PROGRAM or
1380 !* its use. Agilent does not warrant that the SAMPLE
1390 !* PROGRAM is free from infringements or such
1400 !* right of third parties. However, Agilent will not
1410 !* knowingly infringe or deliver a software that
1420 !* infringes the patent, trademark, copyright or
1430 !* other proprietary right of a third party.
1440 !*
1450 !*************************************************
1460  Start_time=TIMEDATE
1470  ASSIGN @Hp4155 TO 800
1480  ASSIGN @Form_off TO 800;FORMAT OFF
1490  COM @Hp4155,@Form_off,Start_time,End_time
1500  COM /File_name/ Vth_file$[12],Wrt_file$[12],Ers_file$[12],Save_file$[12]
1510  COM /Meas_info/ INTEGER Meas_points,REAL Str,Str_num,Meas_str_num(1:55)
1520  COM /Meas_data/ Vth_w(1:55),Vth_e(1:55)
1530  COM /Err/ Err_num(1:6),Err_message$(1:6)[50]
1540  INTEGER I
1550  !
1560  !/////////////// Main /////////////////////////////////////////////
1570  CALL Init_hp4155
1580  ON INTR 8 CALL Err_check
1590  ENABLE INTR 8;2
1600  !
1610  CALL Test_setting
1620  CALL Get_file
1630  !
1640  Str_num=1
1650  FOR I=1 TO Meas_points
1660    CALL Stress_loop(I)
1670    IF Meas_str_num(I)>4500 THEN CALL Calibration
1680    !
1690    OUTPUT @Hp4155;":MMEM:LOAD:STAT 0,'MEM2.STR','MEMORY'"
1700    OUTPUT @Hp4155;":MMEM:LOAD:STAT 0,'MEM1.MES','MEMORY'"
1710    CALL Vth_meas("Write",I)
1720    !
1730    OUTPUT @Hp4155;":MMEM:LOAD:STAT 0,'MEM3.STR','MEMORY'"
1740    CALL Vth_meas("Erase",I)
1750    !
1760    CALL Trans_data(I)
1770    CALL Stress_graph(I)
1780    !
1790    IF Vth_w(I)<.1 OR Vth_e(I)<.1 THEN
1800      PRINT "     ### The Device is broken. Test Aborted ###"
1810      PRINT "         Final Stress Times  : ";Str_num
1820      CALL Final_session
1830      STOP
1840    END IF 
1850    Str_num=Str_num+1
1860  NEXT I
1870  !
1880  CALL Final_session
1890  !
1900  END
1910  !
1920  !/////////////// Sub //////////////////////////////////////////////
1930 Test_setting:SUB Test_setting
1940    COM /File_name/ Vth_file$,Wrt_file$,Ers_file$,Save_file$
1950    COM /Meas_info/ INTEGER Meas_points,REAL Str,Str_num,Meas_str_num(*)
1960    COM /Meas_data/ Vth_w(*),Vth_e(*)
1970    !
1980    Vth_file$="ROMVTH.MES"     ! Vth Measurement Setup File Name
1990    Wrt_file$="NORWRT.STR"     ! Write Stress Setup File Name
2000    Ers_file$="NORERS.STR"     ! Erase Stress Setup File Name
2010    Save_file$=TIME$(TIMEDATE) ! File Name for saving measurement results
2020    Save_file$=Save_file$[1,2]&Save_file$[4,5]&Save_file$[7,7]&".DAT"
2030    Meas_points=16             ! Number of times to repeat Measurement
2040    REDIM Meas_str_num(1:Meas_points)
2050    REDIM Vth_w(1:Meas_points),Vth_e(1:Meas_points)
2060 Str_num: !                    ! Stress Pulse Count data
2070    DATA       1,      2,      5
2080    DATA      10,     20,     50
2090    DATA     100,    200,    500
2100    DATA    1000,   2000,   5000
2110    DATA   10000,  20000,  50000
2120    DATA  100000, 200000, 500000
2130    DATA 1000000
2140    RESTORE Str_num
2150    READ Meas_str_num(*)
2160  SUBEND
2170 !
2180 Init_hp4155:SUB Init_hp4155
2190    COM @Hp4155,@Form_off,Start_time,End_time
2200    !
2210    CLEAR SCREEN
2220    CLEAR @Hp4155
2230    OUTPUT @Hp4155;"*RST"
2240    OUTPUT @Hp4155;"*CLS"
2250    OUTPUT @Hp4155;":STAT:PRES"
2260    OUTPUT @Hp4155;"*ESE 60;*SRE 34;*OPC?"
2270    ENTER @Hp4155;A
2280    OUTPUT @Hp4155;":DISP:WIND:ALL BST"
2290    OUTPUT @Hp4155;":DISP OFF"
2300    PRINT "            <<< Flash ROM Stress Test >>>"
2310    PRINT "Stress Times   Vth Write [V]   Vth Erase [V]   Diff [V]"
2320  SUBEND
2330 !
2340 Get_file:SUB Get_file
2350    COM @Hp4155,@Form_off,Start_time,End_time
2360    COM /File_name/ Vth_file$,Wrt_file$,Ers_file$,Save_file$
2370    !
2380    OUTPUT @Hp4155;":MMEM:COPY '"&Vth_file$&"','DISK','MEM1.MES','MEMORY'"
2390    OUTPUT @Hp4155;":MMEM:COPY '"&Wrt_file$&"','DISK','MEM2.STR','MEMORY'"
2400    OUTPUT @Hp4155;":MMEM:COPY '"&Ers_file$&"','DISK','MEM3.STR','MEMORY'"
2410  SUBEND
2420  !
2430 Calibration:SUB Calibration
2440    COM @Hp4155,@Form_off,Start_time,End_time
2450    !
2460    OUTPUT @Hp4155;":PAGE:SYST:CDI"
2470    OUTPUT @Hp4155;":DISP ON"
2480    OUTPUT @Hp4155;":CAL:ALL?"
2490    ENTER @Hp4155;A
2500    SELECT A
2510    CASE 0
2520      OUTPUT @Hp4155;":PAGE:GLIS"
2530      OUTPUT @Hp4155;":DISP OFF"
2540    CASE ELSE 
2550      PRINT "     #### Calibration FAIL ,Test Aborted ####"
2560      CALL Final_session
2570      STOP
2580    END SELECT 
2590  SUBEND
2600  !
2610 Stress_loop:SUB Stress_loop(INTEGER I)
2620    COM @Hp4155,@Form_off,Start_time,End_time
2630    COM /Meas_info/ INTEGER Meas_points,REAL Str,Str_num,Meas_str_num(*)
2640    INTEGER K
2650    REAL Str_end
2660    !
2670    OUTPUT @Hp4155;":STAT:MEAS:EVEN?"
2680    ENTER @Hp4155;K
2690    OUTPUT @Hp4155;":STAT:MEAS:ENAB 267"
2700    !
2710    OUTPUT @Hp4155;":PAGE:SCON:STAN ON"
2720    Str_end=Meas_str_num(I)-1
2730    FOR Str=Str_num TO Str_end
2740      DISP VAL$(Str);"/";VAL$(Meas_str_num(I))
2750      OUTPUT @Hp4155;"MMEM:LOAD:STAT 0,'MEM2','MEMORY';:PAGE:SCON:STR;*WAI"
2760      OUTPUT @Hp4155;"MMEM:LOAD:STAT 0,'MEM3','MEMORY';:PAGE:SCON:STR"
2770      OUTPUT @Hp4155;"*OPC?"
2780      ENTER @Hp4155;A
2790    NEXT Str
2800    !
2810    Str_num=Str
2820    OUTPUT @Hp4155;":PAGE:SCON:STAN OFF"
2830    OUTPUT @Hp4155;":STAT:MEAS:ENAB 0"
2840  SUBEND
2850  !
2860 Vth_meas:SUB Vth_meas(Str_type$,INTEGER I)
2870    COM @Hp4155,@Form_off,Start_time,End_time
2880    COM /Meas_info/ INTEGER Meas_points,REAL Str,Str_num,Meas_str_num(*)
2890    COM /Meas_data/ Vth_w(*),Vth_e(*)
2900    INTEGER K
2910    !
2920    OUTPUT @Hp4155;":PAGE:SCON:STR;*OPC?"
2930    ENTER @Hp4155;A
2940    DISP Str_type$;" Times = "&VAL$(Str_num)
2950    !
2960    OUTPUT @Hp4155;":PAGE:CHAN:COMM 'Flash ROM Vth Meas. @"&Str_type$&" Times = "&VAL$(Str_num)&"'"
2970    OUTPUT @Hp4155;":PAGE:GLIS"
2980    OUTPUT @Hp4155;":DISP ON"
2990    OUTPUT @Hp4155;":PAGE:SCON:SING;*OPC?"
3000    ENTER @Hp4155;A
3010    OUTPUT @Hp4155;":DISP OFF"
3020    OUTPUT @Hp4155;":STAT:MEAS:EVEN?"
3030    ENTER @Hp4155;K
3040    OUTPUT @Hp4155;":TRAC? 'VTH'"
3050    SELECT Str_type$
3060    CASE "Write"
3070      ENTER @Hp4155;Vth_w(I)
3080      PRINT USING "#,4X,DESZ,10X,SD.DDD";Str_num,Vth_w(I)
3090    CASE "Erase"
3100      ENTER @Hp4155;Vth_e(I)
3110      PRINT USING "10X,SD.DDD,7X,SD.DDE";Vth_e(I),Vth_w(I)-Vth_e(I)
3120    END SELECT 
3130  SUBEND
3140  !
3150 Trans_data:SUB Trans_data(INTEGER I)
3160    COM @Hp4155,@Form_off,Start_time,End_time
3170    COM /Meas_info/ INTEGER Meas_points,REAL Str,Str_num,Meas_str_num(*)
3180    COM /Meas_data/ Vth_w(*),Vth_e(*)
3190    !
3200    REDIM Meas_str_num(1:I),Vth_w(1:I),Vth_e(1:I)
3210    OUTPUT @Hp4155;":TRAC:DEL:ALL"
3220    OUTPUT @Hp4155;":TRAC:DEF 'Stress',"&VAL$(I)
3230    OUTPUT @Hp4155;":TRAC:DEF 'VthWRT',"&VAL$(I)
3240    OUTPUT @Hp4155;":TRAC:DEF 'VthERS',"&VAL$(I)
3250    OUTPUT @Hp4155;":TRAC:UNIT 'Stress','Times'"
3260    OUTPUT @Hp4155;":TRAC:UNIT 'VthWRT','V'"
3270    OUTPUT @Hp4155;":TRAC:UNIT 'VthERS','V'"
3280    !
3290    OUTPUT @Hp4155;":FORM:DATA REAL,64"
3300    OUTPUT @Hp4155;":FORM:BORD NORM"
3310    OUTPUT @Hp4155;":TRAC 'Stress',#0";
3320    OUTPUT @Form_off;Meas_str_num(*),END
3330    OUTPUT @Hp4155;":TRAC 'VthWRT',#0";
3340    OUTPUT @Form_off;Vth_w(*),END
3350    OUTPUT @Hp4155;":TRAC 'VthERS',#0";
3360    OUTPUT @Form_off;Vth_e(*),END
3370    OUTPUT @Hp4155;":FORM:DATA ASCII"
3380    REDIM Meas_str_num(1:Meas_points),Vth_w(1:Meas_points),Vth_e(1:Meas_points)
3390  SUBEND
3400  !
3410 Stress_graph:SUB Stress_graph(INTEGER I)
3420    COM @Hp4155,@Form_off,Start_time,End_time
3430    COM /Meas_info/ INTEGER Meas_points,REAL Str,Str_num,Meas_str_num(*)
3440    !
3450    OUTPUT @Hp4155;":PAGE:CHAN:COMM 'Flash ROM Vth Shift(Stress="&VAL$(Meas_str_num(I))&")'"
3460    OUTPUT @Hp4155;":PAGE:CHAN:UFUN:DEF 'Diff','V','VthWRT-VthERS'"
3470    !
3480    OUTPUT @Hp4155;":PAGE:DISP:GRAP:X:NAME 'Stress'"
3490    OUTPUT @Hp4155;":PAGE:DISP:GRAP:Y1:NAME 'VthWRT'"
3500    OUTPUT @Hp4155;":PAGE:DISP:GRAP:Y2:NAME 'VthERS'"
3510    OUTPUT @Hp4155;":PAGE:DISP:GRAP:X:SCAL LOG"
3520    OUTPUT @Hp4155;":PAGE:DISP:GRAP:X:MIN 1"
3530    OUTPUT @Hp4155;":PAGE:DISP:GRAP:X:MAX "&VAL$(MAX(Meas_str_num(Meas_points),2))
3540    OUTPUT @Hp4155;":PAGE:DISP:GRAP:Y1:SCAL LIN"
3550    OUTPUT @Hp4155;":PAGE:DISP:GRAP:Y1:MIN 0"
3560    OUTPUT @Hp4155;":PAGE:DISP:GRAP:Y1:MAX 7"
3570    OUTPUT @Hp4155;":PAGE:DISP:GRAP:Y2:SCAL LIN"
3580    OUTPUT @Hp4155;":PAGE:DISP:GRAP:Y2:MIN 0"
3590    OUTPUT @Hp4155;":PAGE:DISP:GRAP:Y2:MAX 7"
3600    !
3610    OUTPUT @Hp4155;":PAGE:DISP:DVAR:DEL 'VTH'"
3620    OUTPUT @Hp4155;":PAGE:DISP:DVAR 'Diff'"
3630    !
3640    OUTPUT @Hp4155;":PAGE:DISP:ANAL:LINE1:MODE DIS"
3650    OUTPUT @Hp4155;":PAGE:DISP:ANAL:LINE2:MODE DIS"
3660    OUTPUT @Hp4155;":PAGE:DISP:ANAL:MARK:DIS"
3670    !
3680    OUTPUT @Hp4155;":PAGE:GLIS:INT OFF"
3690    OUTPUT @Hp4155;":PAGE:GLIS:LINE OFF"
3700    OUTPUT @Hp4155;":PAGE:GLIS:MARK ON"
3710    OUTPUT @Hp4155;":PAGE:GLIS:MARK:DIR:X MAX"
3720    !
3730    OUTPUT @Hp4155;":DISP ON;:DISP OFF"
3740  SUBEND
3750  !
3760 Final_session:SUB Final_session
3770    COM @Hp4155,@Form_off,Start_time,End_time
3780    COM /File_name/ Vth_file$,Wrt_file$,Ers_file$,Save_file$
3790    COM /Meas_info/ INTEGER Meas_points,REAL Str,Str_num,Meas_str_num(*)
3800    COM /Err/ Err_num(*),Err_message$(*)
3810    !
3820    IF Str_num-1=Meas_str_num(Meas_points) THEN
3830      Save_file$="D"&Save_file$
3840      PRINT "================ Measurement Completed !!! ================="
3850      PRINT "Final Stress Times  : ";Str_num-1
3860    ELSE 
3870      Save_file$="F"&Save_file$
3880    END IF 
3890    !
3900    PRINT "Save Data File Name : ";Save_file$
3910    PRINT "Test Duration : ";
3920    End_time=TIMEDATE
3930    PRINT DATE$(Start_time);",";TIME$(Start_time);" ~ ";DATE$(End_time);",";TIME$(End_time)
3940    !
3950    DISABLE INTR 8
3960    OUTPUT @Hp4155;":MMEM:STOR:TRAC DEF,'"&Save_file$&"','DISK'"
3970    OUTPUT @Hp4155;"*OPC?"
3980    ENTER @Hp4155;A
3990    OUTPUT @Hp4155;":SYST:ERR?"
4000    ENTER @Hp4155;Err_num(1),Err_message$(1)
4010    IF Err_num(1)<>0 THEN PRINT "### ";Err_num(1);Err_message$(1);" ###"
4020    !
4030    OUTPUT @Hp4155;":DISP:ALL INST"
4040    OUTPUT @Hp4155;":PAGE:GLIS"
4050    OUTPUT @Hp4155;":DISP ON"
4060  SUBEND
4070  !
4080 Err_check:SUB Err_check
4090    COM @Hp4155,@Form_off,Start_time,End_time
4100    COM /Err/ Err_num(*),Err_message$(*)
4110    INTEGER I,J
4120    !
4130    I=0
4140    REPEAT
4150      I=I+1
4160      OUTPUT @Hp4155;":SYST:ERR?"
4170      ENTER @Hp4155;Err_num(I),Err_message$(I)
4180    UNTIL Err_num(I)=0
4190    !
4200    IF I=1 THEN
4210      CALL Meas_stat_check
4220    ELSE 
4230      FOR J=1 TO I-1
4240        PRINT "### ERROR Occurred ###:";Err_num(J);Err_message$(J)
4250        DISP "### ERROR Occurred ###:";Err_num(J);Err_message$(J)
4260      NEXT J
4270      CALL Meas_stat_check
4280      PRINT "              === Test Aborted ==="
4290      CALL Final_session
4300      STOP
4310    END IF 
4320  SUBEND
4330  !
4340 Meas_stat_check:SUB Meas_stat_check
4350    COM @Hp4155,@Form_off,Start_time,End_time
4360    COM /Meas_info/ INTEGER Meas_points,REAL Str,Str_num,Meas_str_num(*)
4370    INTEGER K
4380    !
4390    OUTPUT @Hp4155;":STAT:MEAS:EVEN?"
4400    ENTER @Hp4155;K
4410    !
4420    IF K<>0 THEN
4430      PRINT "### Abnormal Stress Status Event Occurred ###:";K
4440      PRINT "    at Stress Number = ";Str;"[Times]"
4450      PRINT "              === Test Aborted ==="
4460      CALL Final_session
4470      STOP
4480    END IF 
4490  SUBEND
