"4284all-bas"의 두 판 사이의 차이

1번째 줄: 1번째 줄:
10    ![[LCR-4284A]] 4284A, 2017/03/10
+
10    ![[LCR-4284A.bas]] 4284A, 2017/03/10 2020/07/17(TCC추가)
 
<pre>
 
<pre>
 
20    OPTION BASE 1
 
20    OPTION BASE 1
37번째 줄: 37번째 줄:
 
360 Typeselect: !
 
360 Typeselect: !
 
370    INTEGER Type_size,Type_length,Typeno
 
370    INTEGER Type_size,Type_length,Typeno
380    Type_size=8        !문자열 배열의 크기
+
380    Type_size=10      !문자열 배열의 크기
 
390    Type_length=15    !문자열의 길이
 
390    Type_length=15    !문자열의 길이
 
400    ALLOCATE Type$(Type_size)[Type_length]
 
400    ALLOCATE Type$(Type_size)[Type_length]
48번째 줄: 48번째 줄:
 
470    Type$(7)="Freq St-Sp"
 
470    Type$(7)="Freq St-Sp"
 
480    Type$(8)="Freq 1k-1M"
 
480    Type$(8)="Freq 1k-1M"
490    Msg$="테스트 종류를 선택하십시오."
+
490   Type$(9)="TCC"            !SU-222 오븐사용
500   DIALOG "LIST",Msg$,Btn;SET("ITEMS":Type$(*),"COLUMNS":Type_length,"ROWS":Type_size),RETURN("SELECTION":Typeno)
+
500    Type$(10)="TC Freq Sweep"  !주파수스윕하면서
510   Typeno=Typeno+1
+
510   Msg$="테스트 종류를 선택하십시오."
520   SELECT Type$(Typeno)
+
520   DIALOG "LIST",Msg$,Btn;SET("ITEMS":Type$(*),"COLUMNS":Type_length,"ROWS":Type_size),RETURN("SELECTION":Typeno)
530   CASE "Norm"  !샘플이 있는지 없는지 자동 인식
+
530   Typeno=Typeno+1
540     INTEGER Go_count
+
540   SELECT Type$(Typeno)
550     Msg$="A-value lower limit"
+
550   CASE "Norm"  !샘플이 있는지 없는지 자동 인식
560     DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
+
560     INTEGER Go_count
570     IF Btn=-1 OR Btn=1 THEN A_lcl=2.5E-11
+
570     Msg$="A-value lower limit"
580     A_lcl=VAL(String$)
+
580     DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
590     Msg$="A-value upper limit"
+
590     IF Btn=-1 OR Btn=1 THEN A_lcl=2.5E-11
600     DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
+
600     A_lcl=VAL(String$)
610     IF Btn=-1 OR Btn=1 THEN A_ucl=3.5E-11
+
610     Msg$="A-value upper limit"
620     A_ucl=VAL(String$)
+
620     DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
630     Msg$="유효값 연속 횟수"
+
630     IF Btn=-1 OR Btn=1 THEN A_ucl=3.5E-11
640     DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
+
640     A_ucl=VAL(String$)
650     IF Btn=-1 OR Btn=1 THEN Go_limit=5
+
650     Msg$="유효값 연속 횟수"
660     Go_limit=VAL(String$)
+
660     DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
670     Msg$="허용오차 [%]"
+
670     IF Btn=-1 OR Btn=1 THEN Go_limit=5
680     DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
+
680     Go_limit=VAL(String$)
690     IF Btn=-1 OR Btn=1 THEN A_err=.1
+
690     Msg$="허용오차 [%]"
700     A_err=VAL(String$)
+
700     DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
710     OUTPUT @File;"No, A, B, Vm[V], Im[A]"
+
710     IF Btn=-1 OR Btn=1 THEN A_err=.1
720     Count=0
+
720     A_err=VAL(String$)
730     LOOP
+
730     OUTPUT @File;"No, A, B, Vm[V], Im[A]"
740       Count=Count+1
+
740     Count=0
750       REPEAT!샘플이 있나?
+
750     LOOP
760         GOSUB Reading
+
760       Count=Count+1
770       UNTIL A>A_lcl AND A<A_ucl !LCL=lower control limit, UCL=upper control limit
+
770       REPEAT!샘플이 있나?
780       Go_count=0
+
780         GOSUB Reading
790       A_pre=A
+
790       UNTIL A>A_lcl AND A<A_ucl !LCL=lower control limit, UCL=upper control limit
800       REPEAT
+
800       Go_count=0
810         GOSUB Reading
+
810       A_pre=A
820         A_cur=A
+
820       REPEAT
830         IF A_cur=0 THEN STOP
+
830         GOSUB Reading
840         A_delta=ABS((A_cur-A_pre)/A_cur)*100
+
840         A_cur=A
850         IF A_delta<A_err THEN
+
850         IF A_cur=0 THEN STOP
860           Go_count=Go_count+1
+
860         A_delta=ABS((A_cur-A_pre)/A_cur)*100
870         ELSE  
+
870         IF A_delta<A_err THEN
880           Go_count=0
+
880           Go_count=Go_count+1
890         END IF  
+
890         ELSE  
900         A_pre=A_cur
+
900           Go_count=0
910       UNTIL Go_count=Go_limit
+
910         END IF  
920       PRINT "No.=";Count;",A=";A;",B=";B
+
920         A_pre=A_cur
930       OUTPUT @File;Count,A,B,Vm,Im
+
930       UNTIL Go_count=Go_limit
940       BEEP
+
940       PRINT "No.=";Count;",A=";A;",B=";B
950       REPEAT!샘플이 없나?
+
950       OUTPUT @File;Count,A,B,Vm,Im
960         GOSUB Reading
+
960       BEEP
970       UNTIL A<A_lcl OR A>A_ucl
+
970       REPEAT!샘플이 없나?
980      END LOOP  
+
980         GOSUB Reading
990    CASE "Freq Sweep"
+
990       UNTIL A<A_lcl OR A>A_ucl
1000     GOSUB Oscselect
+
1000    END LOOP  
1010     OUTPUT @File;"No, Freq[Hz], A, B, Vm[V], Im[A]"
+
1010  CASE "Freq Sweep"
1020     OUTPUT @Lcr;"FREQ:CW? MIN"
+
1020     GOSUB Oscselect
1030     ENTER @Lcr;Freq_min  !20Hz
+
1030     OUTPUT @File;"No, Freq[Hz], A, B, Vm[V], Im[A]"
1040     OUTPUT @Lcr;"FREQ:CW? MAX"
+
1040     OUTPUT @Lcr;"FREQ:CW? MIN"
1050     ENTER @Lcr;Freq_max  !1MHz
+
1050     ENTER @Lcr;Freq_min  !20Hz
1060     Freq_octv=20 !20:std 50:nexvel spk:50
+
1060     OUTPUT @Lcr;"FREQ:CW? MAX"
1070   ! Freq_min=1000!nexvel=20 spk=100    !!!!!!!!!!!!!!!!!!!!!!!!!
+
1070     ENTER @Lcr;Freq_max  !1MHz
1080   ! Freq_max=10000 !nexvel=20,000 spk=10,000  !!!!!!!!!!!!!!!!!!!!
+
1080     Freq_octv=20 !20:std 50:nexvel spk:50
1090     Freq=Freq_min
+
1090   ! Freq_min=1000!nexvel=20 spk=100    !!!!!!!!!!!!!!!!!!!!!!!!!
1100     Count=0
+
1100   ! Freq_max=10000 !nexvel=20,000 spk=10,000  !!!!!!!!!!!!!!!!!!!!
1110     LOOP
+
1110     Freq=Freq_min
1120       Count=Count+1
+
1120     Count=0
1130       IF Freq>Freq_max THEN Freq=Freq_max
+
1130     LOOP
1140       OUTPUT @Lcr;"FREQ:CW ";Freq    !command
+
1140       Count=Count+1
1150       Freq=Freq*10^(1/Freq_octv)
+
1150       IF Freq>Freq_max THEN Freq=Freq_max
1160       OUTPUT @Lcr;"FREQ:CW?"
+
1160       OUTPUT @Lcr;"FREQ:CW ";Freq    !command
1170       ENTER @Lcr;Freq_level
+
1170       Freq=Freq*10^(1/Freq_octv)
1180       GOSUB Reading
+
1180       OUTPUT @Lcr;"FREQ:CW?"
1190       PRINT "No.=";Count;",Freq=";Freq_level;"Hz,A=";A;",B=";B
+
1190       ENTER @Lcr;Freq_level
1200       OUTPUT @File;Count,Freq_level,A,B,Vm,Im
+
1200       GOSUB Reading
1210       BEEP
+
1210       PRINT "No.=";Count;",Freq=";Freq_level;"Hz,A=";A;",B=";B
1220     EXIT IF Freq>=Freq_max*1.01
+
1220       OUTPUT @File;Count,Freq_level,A,B,Vm,Im
1230     END LOOP  
+
1230       BEEP
1240     OUTPUT @Lcr;"VOLT:LEV 1V"        !init
+
1240     EXIT IF Freq>=Freq_max*1.01
1250   CASE "Freq St-Sp"
+
1250     END LOOP  
1260     GOSUB Oscselect
+
1260     OUTPUT @Lcr;"VOLT:LEV 1V"        !init
1270     OUTPUT @File;"No, Freq[Hz], A, B, Vm[V], Im[A]"
+
1270   CASE "Freq St-Sp"
1280     Freq_min=1000
+
1280     GOSUB Oscselect
1290     Freq_max=5000
+
1290     OUTPUT @File;"No, Freq[Hz], A, B, Vm[V], Im[A]"
1300     Freq=Freq_min
+
1300     Freq_min=100  !100
1310     Count=0
+
1310     Freq_max=300  !1000
1320     FOR Freq=Freq_min TO Freq_max STEP 10
+
1320     Freq=Freq_min
1330       Count=Count+1
+
1330     Count=0
1340       OUTPUT @Lcr;"FREQ:CW ";Freq      !command
+
1340     FOR Freq=Freq_min TO Freq_max STEP 1  !5
1350       OUTPUT @Lcr;"FREQ:CW?"
+
1350       Count=Count+1
1360       ENTER @Lcr;Freq_level
+
1360       OUTPUT @Lcr;"FREQ:CW ";Freq      !command
1370       GOSUB Reading
+
1370       OUTPUT @Lcr;"FREQ:CW?"
1380       PRINT "No.=";Count;",Freq=";Freq_level;"Hz,A=";A;",B=";B
+
1380       ENTER @Lcr;Freq_level
1390       OUTPUT @File;Count,Freq_level,A,B,Vm,Im
+
1390       GOSUB Reading
1400       BEEP
+
1400       PRINT "No.=";Count;",Freq=";Freq_level;"Hz,A=";A;",B=";B
1410     NEXT Freq
+
1410       OUTPUT @File;Count,Freq_level,A,B,Vm,Im
1420     OUTPUT @Lcr;"VOLT:LEV 1V"        !init
+
1420       BEEP
1430   CASE "Freq-48 Sweep"
+
1430     NEXT Freq
1440     GOSUB Oscselect
+
1440     OUTPUT @Lcr;"VOLT:LEV 1V"        !init
1450     GOSUB Freq48
+
1450   CASE "Freq-48 Sweep"
1460     OUTPUT @File;"No, Freq[Hz], A, B, Vm[V], Im[A]"
+
1460     GOSUB Oscselect
1470     FOR I=1 TO 48
+
1470     GOSUB Freq48
1480       OUTPUT @Lcr;"FREQ:CW ";Freq48(I)
+
1480     OUTPUT @File;"No, Freq[Hz], A, B, Vm[V], Im[A]"
1490       GOSUB Reading
+
1490     FOR I=1 TO 48
1500       PRINT "No.=";I;",Freq=";Freq48(I);"Hz,A=";A;",B=";B
+
1500       OUTPUT @Lcr;"FREQ:CW ";Freq48(I)
1510       OUTPUT @File;I,Freq48(I),A,B,Vm,Im
+
1510       GOSUB Reading
1520       BEEP
+
1520       PRINT "No.=";I;",Freq=";Freq48(I);"Hz,A=";A;",B=";B
1530     NEXT I
+
1530       OUTPUT @File;I,Freq48(I),A,B,Vm,Im
1540     OUTPUT @Lcr;"VOLT:LEV 1V"        !init
+
1540       BEEP
1550   CASE "Freq 1k-1M"
+
1550     NEXT I
1560     GOSUB Oscselect
+
1560     OUTPUT @Lcr;"VOLT:LEV 1V"        !init
1570     GOSUB Freq1k1m_read
+
1570   CASE "Freq 1k-1M"
1580     OUTPUT @File;"No, Freq[Hz], A, B, Vm[V], Im[A]"
+
1580     GOSUB Oscselect
1590     FOR I=1 TO 279
+
1590     GOSUB Freq1k1m_read
1600       OUTPUT @Lcr;"FREQ:CW ";Freq1k1m(I)
+
1600     OUTPUT @File;"No, Freq[Hz], A, B, Vm[V], Im[A]"
1610       GOSUB Reading
+
1610     FOR I=1 TO 279
1620       PRINT "No.=";I;",Freq=";Freq1k1m(I);"Hz,A=";A;",B=";B
+
1620       OUTPUT @Lcr;"FREQ:CW ";Freq1k1m(I)
1630       OUTPUT @File;I,Freq1k1m(I),A,B,Vm,Im
+
1630       GOSUB Reading
1640       BEEP
+
1640       PRINT "No.=";I;",Freq=";Freq1k1m(I);"Hz,A=";A;",B=";B
1650     NEXT I
+
1650       OUTPUT @File;I,Freq1k1m(I),A,B,Vm,Im
1660     OUTPUT @Lcr;"VOLT:LEV 1V"        !init
+
1660       BEEP
1670   CASE "DC Bias Sweep"
+
1670     NEXT I
1680     GOSUB Freqselect
+
1680     OUTPUT @Lcr;"VOLT:LEV 1V"        !init
1690     GOSUB Oscselect
+
1690   CASE "DC Bias Sweep"
1700     OUTPUT @File;"No, DC-Bias[V], A, B, Vm[V], Im[A]"
+
1700     GOSUB Freqselect
1710     OUTPUT @Lcr;"BIAS:VOLT:LEV? MIN"
+
1710     GOSUB Oscselect
1720     ENTER @Lcr;Bias_min
+
1720     OUTPUT @File;"No, DC-Bias[V], A, B, Vm[V], Im[A]"
1730     OUTPUT @Lcr;"BIAS:VOLT:LEV? MAX"
+
1730     OUTPUT @Lcr;"BIAS:VOLT:LEV? MIN"
1740     ENTER @Lcr;Bias_max
+
1740     ENTER @Lcr;Bias_min
1750     OUTPUT @Lcr;"BIAS:STAT ON"  ! DC BIAS ON
+
1750     OUTPUT @Lcr;"BIAS:VOLT:LEV? MAX"
1760     Count=0
+
1760     ENTER @Lcr;Bias_max
1770 !  FOR Bias=Bias_min TO Bias_max STEP .5  !0~40V
+
1770     OUTPUT @Lcr;"BIAS:STAT ON"  ! DC BIAS ON
1780    FOR Bias=-40 TO +40 STEP .2              !0~5V NOP=100
+
1780     Count=0
1790      Count=Count+1
+
1790 !  FOR Bias=Bias_min TO Bias_max STEP .5  !0~40V
1800      OUTPUT @Lcr;"BIAS:VOLT:LEV ";Bias      !command
+
1800  !  FOR Bias=-40 TO +40 STEP .2              !0~5V NOP=100
1810       GOSUB Reading
+
1810    FOR Bias=-.1 TO +.1 STEP .001              !-100mA~+100mA
1820       PRINT "No.=";Count;",Bias=";Bias;"V,A=";A;",B=";B
+
1820      Count=Count+1
1830       OUTPUT @File;Count,Bias,A,B,Vm,Im
+
1830  !  OUTPUT @Lcr;"BIAS:VOLT:LEV ";Bias      !command
1840       BEEP
+
1840       OUTPUT @Lcr;"BIAS:CURR:LEV ";Bias      !command
1850     NEXT Bias
+
1850      GOSUB Reading
1860     OUTPUT @Lcr;"BIAS:VOLT:LEV 0V"          !command
+
1860       PRINT "No.=";Count;",Bias=";Bias;"V,A=";A;",B=";B
1870     OUTPUT @Lcr;"BIAS:STAT OFF" ! DC BIAS OFF
+
1870       OUTPUT @File;Count,Bias,A,B,Vm,Im
1880   CASE "Osc Level Sweep"
+
1880       BEEP
1890     GOSUB Freqselect
+
1890     NEXT Bias
1900     OUTPUT @File;"No, Osc-Level[V], A, B, Vm[V], Im[A]"
+
1900     OUTPUT @Lcr;"BIAS:VOLT:LEV 0V"          !command
1910     OUTPUT @Lcr;"VOLT:LEV? MIN"
+
1910     OUTPUT @Lcr;"BIAS:STAT OFF" ! DC BIAS OFF
1920     ENTER @Lcr;Osc_min    !5mV
+
1920   CASE "Osc Level Sweep"
1930     OUTPUT @Lcr;"VOLT:LEV? MAX"
+
1930     GOSUB Freqselect
1940     ENTER @Lcr;Osc_max    !20V
+
1940     OUTPUT @File;"No, Osc-Level[V], A, B, Vm[V], Im[A]"
1950     Osc_octv=20
+
1950     OUTPUT @Lcr;"VOLT:LEV? MIN"
1960     Osc=Osc_min
+
1960     ENTER @Lcr;Osc_min    !5mV
1970     Count=0
+
1970     OUTPUT @Lcr;"VOLT:LEV? MAX"
1980     LOOP
+
1980     ENTER @Lcr;Osc_max    !20V
1990       Count=Count+1
+
1990     Osc_octv=20
2000       OUTPUT @Lcr;"VOLT:LEV ";Osc        !command
+
2000     Osc=Osc_min
2010       Osc=Osc*10^(1/Osc_octv)
+
2010     Count=0
2020       OUTPUT @Lcr;"VOLT:LEV?"
+
2020     LOOP
2030       ENTER @Lcr;Osc_level
+
2030       Count=Count+1
2040       GOSUB Reading
+
2040       OUTPUT @Lcr;"VOLT:LEV ";Osc        !command
2050       PRINT "No.=";Count;",Osc=";Osc_level;"V,A=";A;",B=";B
+
2050       Osc=Osc*10^(1/Osc_octv)
2060       OUTPUT @File;Count,Osc_level,A,B,Vm,Im
+
2060       OUTPUT @Lcr;"VOLT:LEV?"
2070       BEEP
+
2070       ENTER @Lcr;Osc_level
2080     EXIT IF Osc>Osc_max
+
2080       GOSUB Reading
2090     END LOOP  
+
2090       PRINT "No.=";Count;",Osc=";Osc_level;"V,A=";A;",B=";B
2100     OUTPUT @Lcr;"VOLT:LEV 1V"          !init
+
2100       OUTPUT @File;Count,Osc_level,A,B,Vm,Im
2110   CASE "Time Sweep"  !몇 초 간격으로 몇 회
+
2110       BEEP
2120     INTEGER Nop,L1,L2
+
2120     EXIT IF Osc>Osc_max
2130     Msg$="시간간격 [ms]"
+
2130     END LOOP  
2140    DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
+
2140     OUTPUT @Lcr;"VOLT:LEV 1V"          !init
2150    IF Btn=-1 OR Btn=1 THEN STOP
+
2150   CASE "Time Sweep"  !몇 초 간격으로 몇 회
2160    Period=VAL(String$)
+
2160     INTEGER Nop,L1,L2
2170    Msg$="측정횟수    "
+
2170     Msg$="시간간격 [ms]"
 
2180    DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
 
2180    DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
 
2190    IF Btn=-1 OR Btn=1 THEN STOP
 
2190    IF Btn=-1 OR Btn=1 THEN STOP
2200    Nop=VAL(String$)
+
2200    Period=VAL(String$)
2210    GOSUB Freqselect
+
2210    Msg$="측정횟수    "
2220    OUTPUT @File;"No, Time[S], A, B, Vm[V], Im[A]"
+
2220    DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
2230    Count=0
+
2230    IF Btn=-1 OR Btn=1 THEN STOP
2240    T0=TIMEDATE
+
2240    Nop=VAL(String$)
2250    T=TIMEDATE-T0      !second.
+
2250    GOSUB Freqselect
2260    LOOP
+
2260    OUTPUT @File;"No, Time[S], A, B, Vm[V], Im[A]"
2270      Count=Count+1
+
2270     Count=0
2280       GOSUB Reading
+
2280    T0=TIMEDATE
2290       T1=Period/1000.*(Count-1)
+
2290    T=TIMEDATE-T0      !second.
2300       PRINT "No.=";Count;",Time=";T1;"s,A=";A;",B=";B
+
2300    LOOP
2310       OUTPUT @File;Count,T,A,B,Vm,Im
+
2310       Count=Count+1
2320       BEEP
+
2320       GOSUB Reading
2330       LOOP
+
2330       T1=Period/1000.*(Count-1)
2340         T=TIMEDATE-T0        !second.
+
2340       PRINT "No.=";Count;",Time=";T1;"s,A=";A;",B=";B
2350         IF T>3276.7 THEN
+
2350       OUTPUT @File;Count,T,A,B,Vm,Im
2360           L1=INT(T)
+
2360       BEEP
2370           L2=INT(Period/1000)
+
2370       LOOP
2380         ELSE  
+
2380         T=TIMEDATE-T0        !second.
2390           L1=INT(T*10)
+
2390         IF T>3276.7 THEN
2400           L2=INT(Period/100)
+
2400           L1=INT(T)
2410         END IF  
+
2410           L2=INT(Period/1000)
2420       EXIT IF (L1 MOD L2)=0
+
2420         ELSE  
2430       END LOOP  
+
2430           L1=INT(T*10)
2440     EXIT IF Count=Nop
+
2440           L2=INT(Period/100)
2450     END LOOP  
+
2450         END IF  
2460   END SELECT
+
2460       EXIT IF (L1 MOD L2)=0
2470  RETURN
+
2470       END LOOP  
2480 Funcselect:!
+
2480     EXIT IF Count=Nop
2490  INTEGER Func_size,Func_length,Funcno
+
2490     END LOOP  
2500  Func_size=20      !문자열 배열의 크기
+
2500   CASE "TCC"
2510  Func_length=5      !문자열의 길이
+
2510    ASSIGN @Su TO 701
2520  ALLOCATE Funcdis$(Func_size)[Func_length]
+
2520    GOSUB Freqselect
2530  DATA "Cp-D","Cp-Q","Cp-G","Cp-Rp","Cs-D","Cs-Q","Cs-Rs"
+
2530    GOSUB Oscselect
2540  DATA "Lp-Q","Lp-D","Lp-G","Lp-Rp","Ls-D","Ls-Q","Ls-Rs"
+
2540    OUTPUT @File;"No, Time[m], Temp['C], A, B, Vm[V], Im[A]"
2550   DATA "R-X","Z-deg","Z-rad","G-B","Y-deg","Y-rad"
+
2550    Count=0
2560  FOR I=1 TO Func_size
+
2560    Temp0=0
2570     READ Funcdis$(I)
+
2570    T0=TIMEDATE
2580  NEXT I
+
2580    LOOP
2590  ALLOCATE Func$(Func_size)[Func_length]
+
2590      T1=TIMEDATE-T0  !초단위
2600  DATA "CPD","CPQ","CPG","CPRP","CSD","CSQ","CSRS"
+
2600      OUTPUT @Su;"TEMP?"
2610  DATA "LPQ","LPD","LPG","LPRP","LSD","LSQ","LSRS"
+
2610      WAIT .1
2620  DATA "RX","ZTD","ZTR","GB","YTD","YTR"
+
2620      ENTER @Su;Temp,Tmp,Tmp,Tmp
2630  FOR I=1 TO Func_size
+
2630      IF Temp0<>Temp THEN  !온도차이가 0.1도 이상 발생되면 LCR 값을 측정한다.
2640    READ Func$(I)
+
2640        Count=Count+1
2650  NEXT I
+
2650        GOSUB Reading      !A,B,Vm,Im
2660  Msg$="테스트 종류를 선택하십시오."
+
2660        PRINT "No.=";Count;" Time=";T1;"s, Temp=";Temp;"'C, A=";A;", B=";B
2670  DIALOG "LIST",Msg$,Btn;SET("ITEMS":Funcdis$(*),"COLUMNS":Func_length,"ROWS":Func_size),RETURN("SELECTION":Funcno)
+
2670        OUTPUT @File;T1/60.,Temp,A,B,Vm,Im
2680  IF Btn=-1 OR Btn=1 THEN STOP
+
2680      END IF
2690  Funcno=Funcno+1
+
2690      Temp0=Temp
2700  OUTPUT @Lcr;"FUNC:IMP:TYPE ";TRIM$(Func$(Funcno))
+
2700    END LOOP
2710   RETURN
+
2710    OUTPUT @Su;"POWER,OFF"
2720 Oscselect: !
+
2720   CASE "TC Freq Sweep"
2730   INTEGER Osc_size,Osc_length,Oscno
+
2730    GOSUB Oscselect
2740   Osc_size=5        !문자열 배열의 크기
+
2740    OUTPUT @File;"No, Freq[Hz], A, B, Vm[V], Im[A]"
2750   Osc_length=5       !문자열의 길이
+
2750    ASSIGN @Su TO 701
2760   ALLOCATE Oscdis$(Osc_size)[Osc_length]
+
2760     Freq_min=100  !100
2770   Oscdis$(1)="0.02V" !diode
+
2770    Freq_max=300  !1000
2780  Oscdis$(2)="0.05V"
+
2780    Count=0
2790  Oscdis$(3)="0.1V"
+
2790    FOR Temp_set=-20 TO 60 STEP 10
2800  Oscdis$(4)="0.5V"
+
2800      OUTPUT @Su;"TEMP,S";Temp_set      !해당온도로 세팅
2810  Oscdis$(5)="1V"
+
2810      Set=0
2820  Msg$="측정 전압을 선택하십시요"
+
2820      LOOP
2830   DIALOG "LIST",Msg$,Btn;SET("ITEMS":Oscdis$(*),"COLUMNS":Osc_length,"ROWS":Osc_size),RETURN("SELECTION":Oscno)
+
2830        OUTPUT @Su;"TEMP?"
2840   IF Btn=-1 OR Btn=1 THEN STOP
+
2840        WAIT .1
2850  Oscno=Oscno+1
+
2850        ENTER @Su;Temp,Tmp,Tmp,Tmp
2860  OUTPUT @Lcr;"VOLT ";TRIM$(Oscdis$(Oscno))
+
2860        IF Temp=Temp_set THEN
2870  RETURN
+
2870          Set=1
2880 Freqselect:  !
+
2880          WAIT 100    !100초동안 기다린다.
2890  INTEGER Freq_size,Freq_length,Freqno
+
2890        END IF
2900  Freq_size=2        !문자열 배열의 크기
+
2900        IF Set=1 THEN
2910   Freq_length=4      !문자열의 길이
+
2910          OUTPUT @Su;"TEMP?"
2920   ALLOCATE Freqdis$(Freq_size)[Freq_length]
+
2920          WAIT .1
2930   Freqdis$(1)="1KHZ"
+
2930          ENTER @Su;Temp,Tmp,Tmp,Tmp
2940  Freqdis$(2)="1MHZ"
+
2940        END IF
2950  Msg$="주파수를 선택하십시오."
+
2950      EXIT IF Set=1
2960  DIALOG "LIST",Msg$,Btn;SET("ITEMS":Freqdis$(*),"COLUMNS":Freq_length,"ROWS":Freq_size),RETURN("SELECTION":Freqno)
+
2960      END LOOP      !현재 온도가 세팅온도가 되면 루프에서 탈출
2970   IF Btn=-1 OR Btn=1 THEN STOP
+
2970      OUTPUT @File;Temp,"'C"
2980  Freqno=Freqno+1
+
2980      FOR Freq=Freq_min TO Freq_max STEP 1 !5
2990   OUTPUT @Lcr;"FREQ ";TRIM$(Freqdis$(Freqno))
+
2990        Count=Count+1
3000  RETURN
+
3000        OUTPUT @Lcr;"FREQ:CW ";Freq    !command
3010 Freq48:   !
+
3010        OUTPUT @Lcr;"FREQ:CW?"
3020   DIM Freq48(48)
+
3020        ENTER @Lcr;Freq_level
3030   DATA 20,25,30,40,50,60,80
+
3030        GOSUB Reading
3040   DATA 100,120,150,200,250,300,400,500,600,800
+
3040        PRINT "No.=";Count;",Freq=";Freq_level;"Hz,A=";A;",B=";B
3050   DATA 1000,1200,1500,2000,2500,3000,4000,5000,6000,8000
+
3050        OUTPUT @File;Count,Freq_level,A,B,Vm,Im
3060   DATA 10000,12000,15000,20000,25000,30000,40000,50000,60000,80000
+
3060      NEXT Freq
3070   DATA 100000,120000,150000,200000,250000,300000,400000,500000,600000,800000
+
3070    NEXT Temp_set
3080   DATA 1000000
+
3080    OUTPUT @Su;"POWER,OFF"
3090  FOR I=1 TO 48
+
3090  END SELECT
3100    READ Freq48(I)
+
3100   RETURN
3110   NEXT I
+
3110 Funcselect:!
3120  RETURN
+
3120   INTEGER Func_size,Func_length,Funcno
3130 Freq1k1m_read:   !
+
3130   Func_size=20      !문자열 배열의 크기
3140  DIM Freq1k1m(279)
+
3140   Func_length=5     !문자열의 길이
3150   DATA 1,1.00806,1.01351,1.01695,1.02459,1.0274,1.03448,1.04167,1.05263,1.05634
+
3150   ALLOCATE Funcdis$(Func_size)[Func_length]
3160   DATA 1.05932,1.07143,1.07759,1.08696,1.0909,1.09649,1.10294,1.11111,1.11607,1.1194
+
3160   DATA "Cp-D","Cp-Q","Cp-G","Cp-Rp","Cs-D","Cs-Q","Cs-Rs"
3170   DATA 1.13208,1.13637,1.15385,1.15741,1.17188,1.17647,1.17925,1.19048,1.2,1.20192
+
3170   DATA "Lp-Q","Lp-D","Lp-G","Lp-Rp","Ls-D","Ls-Q","Ls-Rs"
3180   DATA 1.20968,1.22449,1.22549,1.22951,1.25,1.27119,1.27551,1.2766,1.2931,1.30208
+
3180   DATA "R-X","Z-deg","Z-rad","G-B","Y-deg","Y-rad"
3190   DATA 1.30435,1.31579,1.32979,1.33929,1.3587,1.36364,1.38889,1.39535,1.41509,1.42045
+
3190   FOR I=1 TO Func_size
3200   DATA 1.42857,1.44231,1.45349,1.46341,1.47059,1.4881,1.5,1.52439,1.53061,1.53846
+
3200    READ Funcdis$(I)
3210   DATA 1.5625,1.57895,1.59574,1.60256,1.62612,1.63043,1.64474,1.66667,1.68919,1.70455
+
3210  NEXT I
3220   DATA 1.71429,1.73611,1.74419,1.76471,1.78571,1.81818,1.82927,1.83824,1.875,1.89394
+
3220   ALLOCATE Func$(Func_size)[Func_length]
3230   DATA 1.92308,1.93548,1.95313,1.97368,2,2.01613,2.02703,2.06897,2.08333,2.14286
+
3230   DATA "CPD","CPQ","CPG","CPRP","CSD","CSQ","CSRS"
3240   DATA 2.15517,2.20588,2.22222,2.23214,2.27273,2.30769,2.31481,2.34375,2.4,2.40385
+
3240  DATA "LPQ","LPD","LPG","LPRP","LSD","LSQ","LSRS"
3250   DATA 2.41935,2.5,2.58621,2.60417,2.6087,2.67857,2.71739,2.72727,2.77778,2.84091
+
3250   DATA "RX","ZTD","ZTR","GB","YTD","YTR"
3260   DATA 2.85714,2.88462,2.97619,3,3.125,3.15789,3.26087,3.28947,3.33333,3.40909
+
3260  FOR I=1 TO Func_size
3270   DATA 3.47222,3.52942,3.57143,3.67647,3.75,3.90625,3.94737,4,4.16667,4.28571
+
3270    READ Func$(I)
3280   DATA 4.41176,4.46429,4.61538,4.6875,4.80769,5,5.17241,5.20833,5.21739,5.35714
+
3280   NEXT I
3290   DATA 5.43478,5.45455,5.55556,5.68182,5.71429,5.76923,5.95238,6,6.25,6.31579
+
3290  Msg$="테스트 종류를 선택하십시오."
3300   DATA 6.52174,6.57895,6.66666,6.81818,6.94444,7.05882,7.14286,7.35294,7.5,7.8125
+
3300  DIALOG "LIST",Msg$,Btn;SET("ITEMS":Funcdis$(*),"COLUMNS":Func_length,"ROWS":Func_size),RETURN("SELECTION":Funcno)
3310  DATA 7.89474,8,8.33333,8.57243,8.82352,8.92857,9.23077,9.375,9.61538,10
+
3310   IF Btn=-1 OR Btn=1 THEN STOP
3320   DATA 10.3448,10.4167,10.4348,10.7143,10.8696,10.9091,11.1111,11.3636,11.4286,11.5385
+
3320   Funcno=Funcno+1
3330   DATA 11.9048,12,12.5,12.6316,13.0435,13.1579,13.3333,13.6364,13.8889,14.1176
+
3330   OUTPUT @Lcr;"FUNC:IMP:TYPE ";TRIM$(Func$(Funcno))
3340   DATA 14.2857,14.7059,15,15.625,15.7895,16,16.6667,17.1429,17.6471,17.8571
+
3340  RETURN
3350   DATA 18.4615,18.75,19.2308,20,20.6897,20.8333,20.8696,21.4286,21.7391,21.8182
+
3350 Oscselect:  !
3360   DATA 22.2222,22.7272,22.8571,23.0769,23.8095,24,25,25.2632,26.087,26.3158
+
3360   INTEGER Osc_size,Osc_length,Oscno
3370   DATA 26.6667,27.2727,27.7778,28.2353,28.5714,29.4118,30,31.25,31.5789,32
+
3370  Osc_size=5        !문자열 배열의 크기
3380   DATA 33.3333,34.2857,35.2941,35.7143,36.9231,37.5,38.4615,40,41.6667,42.8571
+
3380  Osc_length=5      !문자열의 길이
3390   DATA 43.6364,45.4545,46.1538,48,50,53.3333,54.5455,55.5556,60,62.5
+
3390   ALLOCATE Oscdis$(Osc_size)[Osc_length]
3400   DATA 66.6666,68.5714,72.4286,75,80,83.3333,85.7143,96,100,120
+
3400   Oscdis$(1)="0.02V"  !diode
3410   DATA 125,150,160,166.667,200,240,250,300,320,333.333
+
3410   Oscdis$(2)="0.05V"
3420   DATA 400,480,500,600,640,666.667,800,960,1000
+
3420  Oscdis$(3)="0.1V"
3430   RESTORE 3150
+
3430   Oscdis$(4)="0.5V"
3440   FOR I=1 TO 279
+
3440   Oscdis$(5)="1V"
3450     READ Freq1k1m(I)
+
3450   Msg$="측정 전압을 선택하십시요"
3460     Freq1k1m(I)=Freq1k1m(I)*1000.
+
3460  DIALOG "LIST",Msg$,Btn;SET("ITEMS":Oscdis$(*),"COLUMNS":Osc_length,"ROWS":Osc_size),RETURN("SELECTION":Oscno)
3470     PRINT Freq1k1m(I)
+
3470  IF Btn=-1 OR Btn=1 THEN STOP
3480   NEXT I
+
3480  Oscno=Oscno+1
3490  RETURN
+
3490   OUTPUT @Lcr;"VOLT ";TRIM$(Oscdis$(Oscno))
3500 Reading:  !
+
3500  RETURN
3510   OUTPUT @Lcr;"TRIGGER:IMMEDIATE"
+
3510 Freqselect:  !
3520   OUTPUT @Lcr;"FETC:IMP?"
+
3520  INTEGER Freq_size,Freq_length,Freqno
3530   ENTER @Lcr;A,B,Status
+
3530  Freq_size=5        !문자열 배열의 크기
3540   OUTPUT @Lcr;"FETC:SMON:VAC?"
+
3540   Freq_length=5      !문자열의 길이
3550   ENTER @Lcr;Vm
+
3550  ALLOCATE Freqdis$(Freq_size)[Freq_length]
3560   OUTPUT @Lcr;"FETC:SMON:IAC?"
+
3560  Freqdis$(1)="1KHZ"
3570   ENTER @Lcr;Im
+
3570  Freqdis$(2)="1MHZ"
3580   RETURN
+
3580  Freqdis$(3)="214HZ"
3590 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
3590   Freqdis$(4)="330HZ"
3600   END
+
3600   Freqdis$(5)="355HZ"
3610   SUB Errors
+
3610  Msg$="주파수를 선택하십시오."
3620     DIM Err$[50]
+
3620  DIALOG "LIST",Msg$,Btn;SET("ITEMS":Freqdis$(*),"COLUMNS":Freq_length,"ROWS":Freq_size),RETURN("SELECTION":Freqno)
3630     Sp=SPOLL(717)
+
3630  IF Btn=-1 OR Btn=1 THEN STOP
3640     IF BIT(Sp,5) THEN
+
3640  Freqno=Freqno+1
3650       OUTPUT 717;"*ESR?"
+
3650   OUTPUT @Lcr;"FREQ ";TRIM$(Freqdis$(Freqno))
3660       ENTER 717;Esr
+
3660  RETURN
3670       PRINT "Event Status Resister = ";Esr
+
3670 Freq48:  !
3680       LOOP
+
3680  DIM Freq48(48)
3690         OUTPUT 717;"SYST:ERR?"
+
3690  DATA 20,25,30,40,50,60,80
3700         ENTER 717;Err$
+
3700   DATA 100,120,150,200,250,300,400,500,600,800
3710       EXIT IF VAL(Err$)=0
+
3710   DATA 1000,1200,1500,2000,2500,3000,4000,5000,6000,8000
3720         PRINT Err$
+
3720   DATA 10000,12000,15000,20000,25000,30000,40000,50000,60000,80000
3730       END LOOP  
+
3730   DATA 100000,120000,150000,200000,250000,300000,400000,500000,600000,800000
3740     END IF  
+
3740   DATA 1000000
3750     ENABLE INTR 7;2
+
3750  FOR I=1 TO 48
3760   SUBEND
+
3760    READ Freq48(I)
 +
3770  NEXT I
 +
3780  RETURN
 +
3790 Freq1k1m_read:  !
 +
3800  DIM Freq1k1m(279)
 +
3810  DATA 1,1.00806,1.01351,1.01695,1.02459,1.0274,1.03448,1.04167,1.05263,1.05634
 +
3820   DATA 1.05932,1.07143,1.07759,1.08696,1.0909,1.09649,1.10294,1.11111,1.11607,1.1194
 +
3830   DATA 1.13208,1.13637,1.15385,1.15741,1.17188,1.17647,1.17925,1.19048,1.2,1.20192
 +
3840   DATA 1.20968,1.22449,1.22549,1.22951,1.25,1.27119,1.27551,1.2766,1.2931,1.30208
 +
3850   DATA 1.30435,1.31579,1.32979,1.33929,1.3587,1.36364,1.38889,1.39535,1.41509,1.42045
 +
3860   DATA 1.42857,1.44231,1.45349,1.46341,1.47059,1.4881,1.5,1.52439,1.53061,1.53846
 +
3870  DATA 1.5625,1.57895,1.59574,1.60256,1.62612,1.63043,1.64474,1.66667,1.68919,1.70455
 +
3880  DATA 1.71429,1.73611,1.74419,1.76471,1.78571,1.81818,1.82927,1.83824,1.875,1.89394
 +
3890  DATA 1.92308,1.93548,1.95313,1.97368,2,2.01613,2.02703,2.06897,2.08333,2.14286
 +
3900  DATA 2.15517,2.20588,2.22222,2.23214,2.27273,2.30769,2.31481,2.34375,2.4,2.40385
 +
3910  DATA 2.41935,2.5,2.58621,2.60417,2.6087,2.67857,2.71739,2.72727,2.77778,2.84091
 +
3920  DATA 2.85714,2.88462,2.97619,3,3.125,3.15789,3.26087,3.28947,3.33333,3.40909
 +
3930  DATA 3.47222,3.52942,3.57143,3.67647,3.75,3.90625,3.94737,4,4.16667,4.28571
 +
3940  DATA 4.41176,4.46429,4.61538,4.6875,4.80769,5,5.17241,5.20833,5.21739,5.35714
 +
3950  DATA 5.43478,5.45455,5.55556,5.68182,5.71429,5.76923,5.95238,6,6.25,6.31579
 +
3960  DATA 6.52174,6.57895,6.66666,6.81818,6.94444,7.05882,7.14286,7.35294,7.5,7.8125
 +
3970  DATA 7.89474,8,8.33333,8.57243,8.82352,8.92857,9.23077,9.375,9.61538,10
 +
3980   DATA 10.3448,10.4167,10.4348,10.7143,10.8696,10.9091,11.1111,11.3636,11.4286,11.5385
 +
3990   DATA 11.9048,12,12.5,12.6316,13.0435,13.1579,13.3333,13.6364,13.8889,14.1176
 +
4000   DATA 14.2857,14.7059,15,15.625,15.7895,16,16.6667,17.1429,17.6471,17.8571
 +
4010   DATA 18.4615,18.75,19.2308,20,20.6897,20.8333,20.8696,21.4286,21.7391,21.8182
 +
4020   DATA 22.2222,22.7272,22.8571,23.0769,23.8095,24,25,25.2632,26.087,26.3158
 +
4030   DATA 26.6667,27.2727,27.7778,28.2353,28.5714,29.4118,30,31.25,31.5789,32
 +
4040   DATA 33.3333,34.2857,35.2941,35.7143,36.9231,37.5,38.4615,40,41.6667,42.8571
 +
4050   DATA 43.6364,45.4545,46.1538,48,50,53.3333,54.5455,55.5556,60,62.5
 +
4060   DATA 66.6666,68.5714,72.4286,75,80,83.3333,85.7143,96,100,120
 +
4070   DATA 125,150,160,166.667,200,240,250,300,320,333.333
 +
4080   DATA 400,480,500,600,640,666.667,800,960,1000
 +
4090   RESTORE 3810
 +
4100   FOR I=1 TO 279
 +
4110     READ Freq1k1m(I)
 +
4120     Freq1k1m(I)=Freq1k1m(I)*1000.
 +
4130     PRINT Freq1k1m(I)
 +
4140   NEXT I
 +
4150  RETURN
 +
4160 Reading:  !A,B,Vm,Im
 +
4170   OUTPUT @Lcr;"TRIGGER:IMMEDIATE"
 +
4180   OUTPUT @Lcr;"FETC:IMP?"
 +
4190   ENTER @Lcr;A,B,Status
 +
4200   OUTPUT @Lcr;"FETC:SMON:VAC?"
 +
4210   ENTER @Lcr;Vm
 +
4220   OUTPUT @Lcr;"FETC:SMON:IAC?"
 +
4230   ENTER @Lcr;Im
 +
4240   RETURN
 +
4250 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 +
4260   END
 +
4270   SUB Errors
 +
4280     DIM Err$[50]
 +
4290     Sp=SPOLL(717)
 +
4300     IF BIT(Sp,5) THEN
 +
4310       OUTPUT 717;"*ESR?"
 +
4320       ENTER 717;Esr
 +
4330       PRINT "Event Status Resister = ";Esr
 +
4340       LOOP
 +
4350         OUTPUT 717;"SYST:ERR?"
 +
4360         ENTER 717;Err$
 +
4370       EXIT IF VAL(Err$)=0
 +
4380         PRINT Err$
 +
4390       END LOOP  
 +
4400     END IF  
 +
4410     ENABLE INTR 7;2
 +
4420   SUBEND
 
</pre>
 
</pre>

2020년 7월 17일 (금) 11:21 판

10  !LCR-4284A.bas 4284A, 2017/03/10 2020/07/17(TCC추가)

20     OPTION BASE 1
30     INTEGER I,Count,Btn
40     DIM Msg$[50],Id$[50],String$[50]
50     CLEAR SCREEN
60     GOSUB Fileopen
70     GOSUB Setup
80     GOSUB Funcselect
90     GOSUB Typeselect
100    OUTPUT @Lcr;"TRIG:SOUR INT"
110    STOP
120 Setup: !
130    ASSIGN @Lcr TO 717
140    REMOTE @Lcr
150   !OUTPUT @Lcr;"*RST"
160    OUTPUT @Lcr;"*CLS"
170    OUTPUT @Lcr;"*ESE 60"
180    OUTPUT @Lcr;"*SRE 32"
190    ON INTR 7 CALL Errors
200    ENABLE INTR 7;2
210    OUTPUT @Lcr;"*IDN?"
220    ENTER @Lcr;Id$
230    PRINT Id$
240    OUTPUT @Lcr;"TRIG:SOUR BUS"
250    OUTPUT @Lcr;"ABORT;:INIT"
260    RETURN
270 Fileopen:  !
280    DIM Filename$[20],Dhms$[8]
290    Time$=TIME$(TIMEDATE)
300    Date$=DATE$(TIMEDATE)
310    Dhms$=Date$[1;2]&Time$[1;2]&Time$[4;2]&Time$[7;2]
320    Filename$=Dhms$&".txt"
330    CREATE Filename$,1
340    ASSIGN @File TO Filename$;FORMAT ON
350    RETURN
360 Typeselect: !
370    INTEGER Type_size,Type_length,Typeno
380    Type_size=10       !문자열 배열의 크기
390    Type_length=15     !문자열의 길이
400    ALLOCATE Type$(Type_size)[Type_length]
410    Type$(1)="Norm"
420    Type$(2)="Freq Sweep"
430    Type$(3)="Freq-48 Sweep"
440    Type$(4)="DC Bias Sweep"
450    Type$(5)="Osc Level Sweep"
460    Type$(6)="Time Sweep"
470    Type$(7)="Freq St-Sp"
480    Type$(8)="Freq 1k-1M"
490    Type$(9)="TCC"             !SU-222 오븐사용
500    Type$(10)="TC Freq Sweep"  !주파수스윕하면서
510    Msg$="테스트 종류를 선택하십시오."
520    DIALOG "LIST",Msg$,Btn;SET("ITEMS":Type$(*),"COLUMNS":Type_length,"ROWS":Type_size),RETURN("SELECTION":Typeno)
530    Typeno=Typeno+1
540    SELECT Type$(Typeno)
550    CASE "Norm"  !샘플이 있는지 없는지 자동 인식
560      INTEGER Go_count
570      Msg$="A-value lower limit"
580      DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
590      IF Btn=-1 OR Btn=1 THEN A_lcl=2.5E-11
600      A_lcl=VAL(String$)
610      Msg$="A-value upper limit"
620      DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
630      IF Btn=-1 OR Btn=1 THEN A_ucl=3.5E-11
640      A_ucl=VAL(String$)
650      Msg$="유효값 연속 횟수"
660      DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
670      IF Btn=-1 OR Btn=1 THEN Go_limit=5
680      Go_limit=VAL(String$)
690      Msg$="허용오차 [%]"
700      DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
710      IF Btn=-1 OR Btn=1 THEN A_err=.1
720      A_err=VAL(String$)
730      OUTPUT @File;"No, A, B, Vm[V], Im[A]"
740      Count=0
750      LOOP
760        Count=Count+1
770        REPEAT!샘플이 있나?
780          GOSUB Reading
790        UNTIL A>A_lcl AND A<A_ucl !LCL=lower control limit, UCL=upper control limit
800        Go_count=0
810        A_pre=A
820        REPEAT
830          GOSUB Reading
840          A_cur=A
850          IF A_cur=0 THEN STOP
860          A_delta=ABS((A_cur-A_pre)/A_cur)*100
870          IF A_delta<A_err THEN
880            Go_count=Go_count+1
890          ELSE 
900            Go_count=0
910          END IF 
920          A_pre=A_cur
930        UNTIL Go_count=Go_limit
940        PRINT "No.=";Count;",A=";A;",B=";B
950        OUTPUT @File;Count,A,B,Vm,Im
960        BEEP
970        REPEAT!샘플이 없나?
980          GOSUB Reading
990        UNTIL A<A_lcl OR A>A_ucl
1000     END LOOP 
1010   CASE "Freq Sweep"
1020     GOSUB Oscselect
1030     OUTPUT @File;"No, Freq[Hz], A, B, Vm[V], Im[A]"
1040     OUTPUT @Lcr;"FREQ:CW? MIN"
1050     ENTER @Lcr;Freq_min  !20Hz
1060     OUTPUT @Lcr;"FREQ:CW? MAX"
1070     ENTER @Lcr;Freq_max  !1MHz
1080     Freq_octv=20 !20:std 50:nexvel spk:50
1090   ! Freq_min=1000!nexvel=20 spk=100    !!!!!!!!!!!!!!!!!!!!!!!!!
1100   ! Freq_max=10000 !nexvel=20,000 spk=10,000  !!!!!!!!!!!!!!!!!!!!
1110     Freq=Freq_min
1120     Count=0
1130     LOOP
1140       Count=Count+1
1150       IF Freq>Freq_max THEN Freq=Freq_max
1160       OUTPUT @Lcr;"FREQ:CW ";Freq     !command
1170       Freq=Freq*10^(1/Freq_octv)
1180       OUTPUT @Lcr;"FREQ:CW?"
1190       ENTER @Lcr;Freq_level
1200       GOSUB Reading
1210       PRINT "No.=";Count;",Freq=";Freq_level;"Hz,A=";A;",B=";B
1220       OUTPUT @File;Count,Freq_level,A,B,Vm,Im
1230       BEEP
1240     EXIT IF Freq>=Freq_max*1.01
1250     END LOOP 
1260     OUTPUT @Lcr;"VOLT:LEV 1V"        !init
1270   CASE "Freq St-Sp"
1280     GOSUB Oscselect
1290     OUTPUT @File;"No, Freq[Hz], A, B, Vm[V], Im[A]"
1300     Freq_min=100  !100
1310     Freq_max=300  !1000
1320     Freq=Freq_min
1330     Count=0
1340     FOR Freq=Freq_min TO Freq_max STEP 1  !5
1350       Count=Count+1
1360       OUTPUT @Lcr;"FREQ:CW ";Freq      !command
1370       OUTPUT @Lcr;"FREQ:CW?"
1380       ENTER @Lcr;Freq_level
1390       GOSUB Reading
1400       PRINT "No.=";Count;",Freq=";Freq_level;"Hz,A=";A;",B=";B
1410       OUTPUT @File;Count,Freq_level,A,B,Vm,Im
1420       BEEP
1430     NEXT Freq
1440     OUTPUT @Lcr;"VOLT:LEV 1V"         !init
1450   CASE "Freq-48 Sweep"
1460     GOSUB Oscselect
1470     GOSUB Freq48
1480     OUTPUT @File;"No, Freq[Hz], A, B, Vm[V], Im[A]"
1490     FOR I=1 TO 48
1500       OUTPUT @Lcr;"FREQ:CW ";Freq48(I)
1510       GOSUB Reading
1520       PRINT "No.=";I;",Freq=";Freq48(I);"Hz,A=";A;",B=";B
1530       OUTPUT @File;I,Freq48(I),A,B,Vm,Im
1540       BEEP
1550     NEXT I
1560     OUTPUT @Lcr;"VOLT:LEV 1V"         !init
1570   CASE "Freq 1k-1M"
1580     GOSUB Oscselect
1590     GOSUB Freq1k1m_read
1600     OUTPUT @File;"No, Freq[Hz], A, B, Vm[V], Im[A]"
1610     FOR I=1 TO 279
1620       OUTPUT @Lcr;"FREQ:CW ";Freq1k1m(I)
1630       GOSUB Reading
1640       PRINT "No.=";I;",Freq=";Freq1k1m(I);"Hz,A=";A;",B=";B
1650       OUTPUT @File;I,Freq1k1m(I),A,B,Vm,Im
1660       BEEP
1670     NEXT I
1680     OUTPUT @Lcr;"VOLT:LEV 1V"         !init
1690   CASE "DC Bias Sweep"
1700     GOSUB Freqselect
1710     GOSUB Oscselect
1720     OUTPUT @File;"No, DC-Bias[V], A, B, Vm[V], Im[A]"
1730     OUTPUT @Lcr;"BIAS:VOLT:LEV? MIN"
1740     ENTER @Lcr;Bias_min
1750     OUTPUT @Lcr;"BIAS:VOLT:LEV? MAX"
1760     ENTER @Lcr;Bias_max
1770     OUTPUT @Lcr;"BIAS:STAT ON"  ! DC BIAS ON
1780     Count=0
1790  !  FOR Bias=Bias_min TO Bias_max STEP .5  !0~40V
1800  !  FOR Bias=-40 TO +40 STEP .2              !0~5V NOP=100
1810     FOR Bias=-.1 TO +.1 STEP .001              !-100mA~+100mA
1820       Count=Count+1
1830   !   OUTPUT @Lcr;"BIAS:VOLT:LEV ";Bias      !command
1840       OUTPUT @Lcr;"BIAS:CURR:LEV ";Bias      !command
1850       GOSUB Reading
1860       PRINT "No.=";Count;",Bias=";Bias;"V,A=";A;",B=";B
1870       OUTPUT @File;Count,Bias,A,B,Vm,Im
1880       BEEP
1890     NEXT Bias
1900     OUTPUT @Lcr;"BIAS:VOLT:LEV 0V"           !command
1910     OUTPUT @Lcr;"BIAS:STAT OFF" ! DC BIAS OFF
1920   CASE "Osc Level Sweep"
1930     GOSUB Freqselect
1940     OUTPUT @File;"No, Osc-Level[V], A, B, Vm[V], Im[A]"
1950     OUTPUT @Lcr;"VOLT:LEV? MIN"
1960     ENTER @Lcr;Osc_min    !5mV
1970     OUTPUT @Lcr;"VOLT:LEV? MAX"
1980     ENTER @Lcr;Osc_max    !20V
1990     Osc_octv=20
2000     Osc=Osc_min
2010     Count=0
2020     LOOP
2030       Count=Count+1
2040       OUTPUT @Lcr;"VOLT:LEV ";Osc        !command
2050       Osc=Osc*10^(1/Osc_octv)
2060       OUTPUT @Lcr;"VOLT:LEV?"
2070       ENTER @Lcr;Osc_level
2080       GOSUB Reading
2090       PRINT "No.=";Count;",Osc=";Osc_level;"V,A=";A;",B=";B
2100       OUTPUT @File;Count,Osc_level,A,B,Vm,Im
2110       BEEP
2120     EXIT IF Osc>Osc_max
2130     END LOOP 
2140     OUTPUT @Lcr;"VOLT:LEV 1V"          !init
2150   CASE "Time Sweep"  !몇 초 간격으로 몇 회
2160     INTEGER Nop,L1,L2
2170     Msg$="시간간격 [ms]"
2180     DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
2190     IF Btn=-1 OR Btn=1 THEN STOP
2200     Period=VAL(String$)
2210     Msg$="측정횟수     "
2220     DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
2230     IF Btn=-1 OR Btn=1 THEN STOP
2240     Nop=VAL(String$)
2250     GOSUB Freqselect
2260     OUTPUT @File;"No, Time[S], A, B, Vm[V], Im[A]"
2270     Count=0
2280     T0=TIMEDATE
2290     T=TIMEDATE-T0       !second.
2300     LOOP
2310       Count=Count+1
2320       GOSUB Reading
2330       T1=Period/1000.*(Count-1)
2340       PRINT "No.=";Count;",Time=";T1;"s,A=";A;",B=";B
2350       OUTPUT @File;Count,T,A,B,Vm,Im
2360       BEEP
2370       LOOP
2380         T=TIMEDATE-T0         !second.
2390         IF T>3276.7 THEN
2400           L1=INT(T)
2410           L2=INT(Period/1000)
2420         ELSE 
2430           L1=INT(T*10)
2440           L2=INT(Period/100)
2450         END IF 
2460       EXIT IF (L1 MOD L2)=0
2470       END LOOP 
2480     EXIT IF Count=Nop
2490     END LOOP 
2500   CASE "TCC"
2510     ASSIGN @Su TO 701
2520     GOSUB Freqselect
2530     GOSUB Oscselect
2540     OUTPUT @File;"No, Time[m], Temp['C], A, B, Vm[V], Im[A]"
2550     Count=0
2560     Temp0=0
2570     T0=TIMEDATE
2580     LOOP
2590       T1=TIMEDATE-T0  !초단위
2600       OUTPUT @Su;"TEMP?"
2610       WAIT .1
2620       ENTER @Su;Temp,Tmp,Tmp,Tmp
2630       IF Temp0<>Temp THEN   !온도차이가 0.1도 이상 발생되면 LCR 값을 측정한다.
2640         Count=Count+1
2650         GOSUB Reading       !A,B,Vm,Im
2660         PRINT "No.=";Count;" Time=";T1;"s, Temp=";Temp;"'C, A=";A;", B=";B
2670         OUTPUT @File;T1/60.,Temp,A,B,Vm,Im
2680       END IF 
2690       Temp0=Temp
2700     END LOOP 
2710     OUTPUT @Su;"POWER,OFF"
2720   CASE "TC Freq Sweep"
2730     GOSUB Oscselect
2740     OUTPUT @File;"No, Freq[Hz], A, B, Vm[V], Im[A]"
2750     ASSIGN @Su TO 701
2760     Freq_min=100  !100
2770     Freq_max=300  !1000
2780     Count=0
2790     FOR Temp_set=-20 TO 60 STEP 10
2800       OUTPUT @Su;"TEMP,S";Temp_set      !해당온도로 세팅
2810       Set=0
2820       LOOP
2830         OUTPUT @Su;"TEMP?"
2840         WAIT .1
2850         ENTER @Su;Temp,Tmp,Tmp,Tmp
2860         IF Temp=Temp_set THEN
2870           Set=1
2880           WAIT 100     !100초동안 기다린다.
2890         END IF 
2900         IF Set=1 THEN
2910           OUTPUT @Su;"TEMP?"
2920           WAIT .1
2930           ENTER @Su;Temp,Tmp,Tmp,Tmp
2940         END IF 
2950       EXIT IF Set=1
2960       END LOOP       !현재 온도가 세팅온도가 되면 루프에서 탈출
2970       OUTPUT @File;Temp,"'C"
2980       FOR Freq=Freq_min TO Freq_max STEP 1  !5
2990         Count=Count+1
3000         OUTPUT @Lcr;"FREQ:CW ";Freq     !command
3010         OUTPUT @Lcr;"FREQ:CW?"
3020         ENTER @Lcr;Freq_level
3030         GOSUB Reading
3040         PRINT "No.=";Count;",Freq=";Freq_level;"Hz,A=";A;",B=";B
3050         OUTPUT @File;Count,Freq_level,A,B,Vm,Im
3060       NEXT Freq
3070     NEXT Temp_set
3080     OUTPUT @Su;"POWER,OFF"
3090   END SELECT 
3100   RETURN
3110 Funcselect:!
3120   INTEGER Func_size,Func_length,Funcno
3130   Func_size=20       !문자열 배열의 크기
3140   Func_length=5      !문자열의 길이
3150   ALLOCATE Funcdis$(Func_size)[Func_length]
3160   DATA "Cp-D","Cp-Q","Cp-G","Cp-Rp","Cs-D","Cs-Q","Cs-Rs"
3170   DATA "Lp-Q","Lp-D","Lp-G","Lp-Rp","Ls-D","Ls-Q","Ls-Rs"
3180   DATA "R-X","Z-deg","Z-rad","G-B","Y-deg","Y-rad"
3190   FOR I=1 TO Func_size
3200     READ Funcdis$(I)
3210   NEXT I
3220   ALLOCATE Func$(Func_size)[Func_length]
3230   DATA "CPD","CPQ","CPG","CPRP","CSD","CSQ","CSRS"
3240   DATA "LPQ","LPD","LPG","LPRP","LSD","LSQ","LSRS"
3250   DATA "RX","ZTD","ZTR","GB","YTD","YTR"
3260   FOR I=1 TO Func_size
3270     READ Func$(I)
3280   NEXT I
3290   Msg$="테스트 종류를 선택하십시오."
3300   DIALOG "LIST",Msg$,Btn;SET("ITEMS":Funcdis$(*),"COLUMNS":Func_length,"ROWS":Func_size),RETURN("SELECTION":Funcno)
3310   IF Btn=-1 OR Btn=1 THEN STOP
3320   Funcno=Funcno+1
3330   OUTPUT @Lcr;"FUNC:IMP:TYPE ";TRIM$(Func$(Funcno))
3340   RETURN
3350 Oscselect:  !
3360   INTEGER Osc_size,Osc_length,Oscno
3370   Osc_size=5         !문자열 배열의 크기
3380   Osc_length=5       !문자열의 길이
3390   ALLOCATE Oscdis$(Osc_size)[Osc_length]
3400   Oscdis$(1)="0.02V"  !diode
3410   Oscdis$(2)="0.05V"
3420   Oscdis$(3)="0.1V"
3430   Oscdis$(4)="0.5V"
3440   Oscdis$(5)="1V"
3450   Msg$="측정 전압을 선택하십시요"
3460   DIALOG "LIST",Msg$,Btn;SET("ITEMS":Oscdis$(*),"COLUMNS":Osc_length,"ROWS":Osc_size),RETURN("SELECTION":Oscno)
3470   IF Btn=-1 OR Btn=1 THEN STOP
3480   Oscno=Oscno+1
3490   OUTPUT @Lcr;"VOLT ";TRIM$(Oscdis$(Oscno))
3500   RETURN
3510 Freqselect:  !
3520   INTEGER Freq_size,Freq_length,Freqno
3530   Freq_size=5        !문자열 배열의 크기
3540   Freq_length=5      !문자열의 길이
3550   ALLOCATE Freqdis$(Freq_size)[Freq_length]
3560   Freqdis$(1)="1KHZ"
3570   Freqdis$(2)="1MHZ"
3580   Freqdis$(3)="214HZ"
3590   Freqdis$(4)="330HZ"
3600   Freqdis$(5)="355HZ"
3610   Msg$="주파수를 선택하십시오."
3620   DIALOG "LIST",Msg$,Btn;SET("ITEMS":Freqdis$(*),"COLUMNS":Freq_length,"ROWS":Freq_size),RETURN("SELECTION":Freqno)
3630   IF Btn=-1 OR Btn=1 THEN STOP
3640   Freqno=Freqno+1
3650   OUTPUT @Lcr;"FREQ ";TRIM$(Freqdis$(Freqno))
3660   RETURN
3670 Freq48:   !
3680   DIM Freq48(48)
3690   DATA 20,25,30,40,50,60,80
3700   DATA 100,120,150,200,250,300,400,500,600,800
3710   DATA 1000,1200,1500,2000,2500,3000,4000,5000,6000,8000
3720   DATA 10000,12000,15000,20000,25000,30000,40000,50000,60000,80000
3730   DATA 100000,120000,150000,200000,250000,300000,400000,500000,600000,800000
3740   DATA 1000000
3750   FOR I=1 TO 48
3760     READ Freq48(I)
3770   NEXT I
3780   RETURN
3790 Freq1k1m_read:   !
3800   DIM Freq1k1m(279)
3810   DATA 1,1.00806,1.01351,1.01695,1.02459,1.0274,1.03448,1.04167,1.05263,1.05634
3820   DATA 1.05932,1.07143,1.07759,1.08696,1.0909,1.09649,1.10294,1.11111,1.11607,1.1194
3830   DATA 1.13208,1.13637,1.15385,1.15741,1.17188,1.17647,1.17925,1.19048,1.2,1.20192
3840   DATA 1.20968,1.22449,1.22549,1.22951,1.25,1.27119,1.27551,1.2766,1.2931,1.30208
3850   DATA 1.30435,1.31579,1.32979,1.33929,1.3587,1.36364,1.38889,1.39535,1.41509,1.42045
3860   DATA 1.42857,1.44231,1.45349,1.46341,1.47059,1.4881,1.5,1.52439,1.53061,1.53846
3870   DATA 1.5625,1.57895,1.59574,1.60256,1.62612,1.63043,1.64474,1.66667,1.68919,1.70455
3880   DATA 1.71429,1.73611,1.74419,1.76471,1.78571,1.81818,1.82927,1.83824,1.875,1.89394
3890   DATA 1.92308,1.93548,1.95313,1.97368,2,2.01613,2.02703,2.06897,2.08333,2.14286
3900   DATA 2.15517,2.20588,2.22222,2.23214,2.27273,2.30769,2.31481,2.34375,2.4,2.40385
3910   DATA 2.41935,2.5,2.58621,2.60417,2.6087,2.67857,2.71739,2.72727,2.77778,2.84091
3920   DATA 2.85714,2.88462,2.97619,3,3.125,3.15789,3.26087,3.28947,3.33333,3.40909
3930   DATA 3.47222,3.52942,3.57143,3.67647,3.75,3.90625,3.94737,4,4.16667,4.28571
3940   DATA 4.41176,4.46429,4.61538,4.6875,4.80769,5,5.17241,5.20833,5.21739,5.35714
3950   DATA 5.43478,5.45455,5.55556,5.68182,5.71429,5.76923,5.95238,6,6.25,6.31579
3960   DATA 6.52174,6.57895,6.66666,6.81818,6.94444,7.05882,7.14286,7.35294,7.5,7.8125
3970   DATA 7.89474,8,8.33333,8.57243,8.82352,8.92857,9.23077,9.375,9.61538,10
3980   DATA 10.3448,10.4167,10.4348,10.7143,10.8696,10.9091,11.1111,11.3636,11.4286,11.5385
3990   DATA 11.9048,12,12.5,12.6316,13.0435,13.1579,13.3333,13.6364,13.8889,14.1176
4000   DATA 14.2857,14.7059,15,15.625,15.7895,16,16.6667,17.1429,17.6471,17.8571
4010   DATA 18.4615,18.75,19.2308,20,20.6897,20.8333,20.8696,21.4286,21.7391,21.8182
4020   DATA 22.2222,22.7272,22.8571,23.0769,23.8095,24,25,25.2632,26.087,26.3158
4030   DATA 26.6667,27.2727,27.7778,28.2353,28.5714,29.4118,30,31.25,31.5789,32
4040   DATA 33.3333,34.2857,35.2941,35.7143,36.9231,37.5,38.4615,40,41.6667,42.8571
4050   DATA 43.6364,45.4545,46.1538,48,50,53.3333,54.5455,55.5556,60,62.5
4060   DATA 66.6666,68.5714,72.4286,75,80,83.3333,85.7143,96,100,120
4070   DATA 125,150,160,166.667,200,240,250,300,320,333.333
4080   DATA 400,480,500,600,640,666.667,800,960,1000
4090   RESTORE 3810
4100   FOR I=1 TO 279
4110     READ Freq1k1m(I)
4120     Freq1k1m(I)=Freq1k1m(I)*1000.
4130     PRINT Freq1k1m(I)
4140   NEXT I
4150   RETURN
4160 Reading:   !A,B,Vm,Im
4170   OUTPUT @Lcr;"TRIGGER:IMMEDIATE"
4180   OUTPUT @Lcr;"FETC:IMP?"
4190   ENTER @Lcr;A,B,Status
4200   OUTPUT @Lcr;"FETC:SMON:VAC?"
4210   ENTER @Lcr;Vm
4220   OUTPUT @Lcr;"FETC:SMON:IAC?"
4230   ENTER @Lcr;Im
4240   RETURN
4250 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
4260   END
4270   SUB Errors
4280     DIM Err$[50]
4290     Sp=SPOLL(717)
4300     IF BIT(Sp,5) THEN
4310       OUTPUT 717;"*ESR?"
4320       ENTER 717;Esr
4330       PRINT "Event Status Resister = ";Esr
4340       LOOP
4350         OUTPUT 717;"SYST:ERR?"
4360         ENTER 717;Err$
4370       EXIT IF VAL(Err$)=0
4380         PRINT Err$
4390       END LOOP 
4400     END IF 
4410     ENABLE INTR 7;2
4420   SUBEND