4284all-bas

Togotech (토론 | 기여)님의 2024년 4월 25일 (목) 12:48 판
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

LCR-4284A

10     ![[LCR-4284A.bas]] 4284A, 2024/04/25
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=20       !문자열 배열의 크기
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    Type$(11)="Speaker-Nexvell"  !스피커
520    Type$(12)="Earphone"  !이어폰 osc=0.1V
530    Type$(13)="Speaker"  !스피커
540    Type$(14)="Piezo Buzzer"  !
550    Type$(15)="AF-VCM 20-1k" !
560    Type$(16)="Galvano" !400-600Hz  !20Hz~1KHz
570    Type$(17)="Osc Spk"
580    Type$(18)="100-300Hz"
590    Type$(19)="150-200Hz"
600    Msg$="테스트 종류를 선택하십시오."
610    DIALOG "LIST",Msg$,Btn;SET("ITEMS":Type$(*),"COLUMNS":Type_length,"ROWS":Type_size),RETURN("SELECTION":Typeno)
620    Typeno=Typeno+1
630    SELECT Type$(Typeno)
640    CASE "Norm"  !샘플이 있는지 없는지 자동 인식
650      INTEGER Go_count
660      Msg$="A-value lower limit"
670      DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
680      IF Btn=-1 OR Btn=1 THEN A_lcl=2.5E-11
690      A_lcl=VAL(String$)
700      Msg$="A-value upper limit"
710      DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
720      IF Btn=-1 OR Btn=1 THEN A_ucl=3.5E-11
730      A_ucl=VAL(String$)
740      Msg$="유효값 연속 횟수"
750      DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
760      IF Btn=-1 OR Btn=1 THEN Go_limit=5
770      Go_limit=VAL(String$)
780      Msg$="허용오차 [%]"
790      DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
800      IF Btn=-1 OR Btn=1 THEN A_err=.1
810      A_err=VAL(String$)
820      OUTPUT @File;"No, A, B, Vm[V], Im[A]"
830      Count=0
840      LOOP
850        Count=Count+1
860        REPEAT!샘플이 있나?
870          GOSUB Reading
880        UNTIL A>A_lcl AND A<A_ucl !LCL=lower control limit, UCL=upper control limit
890        Go_count=0
900        A_pre=A
910        REPEAT
920          GOSUB Reading
930          A_cur=A
940          IF A_cur=0 THEN STOP
950          A_delta=ABS((A_cur-A_pre)/A_cur)*100
960          IF A_delta<A_err THEN
970            Go_count=Go_count+1
980          ELSE 
990            Go_count=0
1000         END IF 
1010         A_pre=A_cur
1020       UNTIL Go_count=Go_limit
1030       PRINT "No.=";Count;",A=";A;",B=";B
1040       OUTPUT @File;Count,A,B,Vm,Im
1050       BEEP
1060       REPEAT!샘플이 없나?
1070         GOSUB Reading
1080       UNTIL A<A_lcl OR A>A_ucl
1090     END LOOP 
1100   CASE "Freq Sweep","Speaker-Nexvell","Speaker","Earphone"
1110     SELECT Type$(Typeno)
1120     CASE "Earphone"
1130       OUTPUT @Lcr;"VOLT:LEV 0.1V"
1140     CASE ELSE 
1150       GOSUB Oscselect
1160     END SELECT 
1170     OUTPUT @File;"No, Freq[Hz], A, B, Vm[V], Im[A]"
1180     OUTPUT @Lcr;"FREQ:CW? MIN"
1190     ENTER @Lcr;Freq_min  !20Hz
1200     OUTPUT @Lcr;"FREQ:CW? MAX"
1210     ENTER @Lcr;Freq_max  !1MHz
1220     SELECT Type$(Typeno)
1230     CASE "Freq Sweep"
1240       Freq_octv=20
1250       Freq_min=20
1260       Freq_max=1.E+6
1270       GOSUB Chart_var
1280       GOSUB Init_chart
1290     CASE "Speaker-Nexvell"
1300       Freq_octv=50
1310       Freq_min=20
1320       Freq_max=10000
1330     CASE "Earphone"
1340       Freq_octv=100
1350       Freq_min=20
1360       Freq_max=20000
1370     CASE "Speaker"
1380       Freq_octv=100
1390       Freq_min=20
1400       Freq_max=20000
1410     END SELECT 
1420     Freq=Freq_min
1430     Count=0
1440     Freq_p=0
1450     LOOP
1460       IF Freq>Freq_max THEN Freq=Freq_max
1470       OUTPUT @Lcr;"FREQ:CW ";Freq     !command
1480       OUTPUT @Lcr;"FREQ:CW?"
1490       ENTER @Lcr;Freq_level
1500       IF Freq_p<>Freq_level THEN
1510         Count=Count+1
1520         Freq_p=Freq_level
1530         Log_freq=LOG(Freq_level)/LOG(10)
1540         GOSUB Reading
1550         IF A<0 THEN
1560           Y(1)=.1
1570         ELSE 
1580           Y(1)=LOG(A)/LOG(10)
1590         END IF 
1600         Y(2)=.1 !사용하지 않음
1610         CONTROL @Strip;SET("POINT LOCATION":Log_freq,"VALUES":Y(*))
1620         PRINT "No.=";Count;",Freq=";Freq_level;"Hz,A=";A;",B=";B
1630         OUTPUT @File;Count,Freq_level,A,B,Vm,Im
1640         BEEP
1650       END IF 
1660       Freq=Freq*10^(1/Freq_octv)
1670     EXIT IF Freq_level>=Freq_max
1680     END LOOP 
1690     OUTPUT @Lcr;"FREQ:CW 1000"  !연결되었는지 확인하기 위해 1kHz 발진
1700     SELECT Type$(Typeno)
1710     CASE "Earphone"
1720       OUTPUT @Lcr;"VOLT:LEV 0.1V"
1730     CASE ELSE 
1740       OUTPUT @Lcr;"VOLT:LEV 1V"      !init
1750     END SELECT 
1760   CASE "Piezo Buzzer"
1770     GOSUB Oscselect
1780     OUTPUT @File;"No, Freq[Hz], A, B, Vm[V], Im[A]"
1790     Freq_min=1000  !반드시
1800     Freq_max=5000  !1M 이내에서
1810     Freq=Freq_min
1820     GOSUB Freq1k1m_read
1830     Count=0
1840     LOOP
1850       Count=Count+1
1860       OUTPUT @Lcr;"FREQ:CW ";Freq1k1m(Count)  !command
1870       OUTPUT @Lcr;"FREQ:CW?"
1880       ENTER @Lcr;Freq_level
1890       GOSUB Reading
1900       PRINT "No.=";Count;",Freq=";Freq_level;"Hz,A=";A;",B=";B
1910       OUTPUT @File;Count,Freq_level,A,B,Vm,Im
1920       BEEP
1930     EXIT IF Freq_level>Freq_max
1940     END LOOP 
1950     OUTPUT @Lcr;"FREQ:CW ";Freq1k1m(1)  !1kHz
1960     OUTPUT @Lcr;"VOLT:LEV 1V"         !init
1970   CASE "AF-VCM 20-1k"
1980     GOSUB Oscselect
1990     OUTPUT @File;"No, Freq[Hz], A, B, Vm[V], Im[A]"
2000     Freq_min=20   !100
2010     Freq_max=1000   !1000
2020     Freq=Freq_min
2030     Count=0
2040     Freq_p=0
2050     FOR Freq=Freq_min TO Freq_max STEP 5  !5
2060       OUTPUT @Lcr;"FREQ:CW ";Freq      !command
2070       OUTPUT @Lcr;"FREQ:CW?"
2080       ENTER @Lcr;Freq_level
2090       IF Freq_p<>Freq_level THEN
2100         Count=Count+1
2110         GOSUB Reading
2120         PRINT "No.=";Count;",Freq=";Freq_level;"Hz,A=";A;",B=";B
2130         OUTPUT @File;Count,Freq_level,A,B,Vm,Im
2140         Freq_p=Freq_level
2150         BEEP
2160       END IF 
2170     NEXT Freq
2180     OUTPUT @Lcr;"VOLT:LEV 1V"         !init
2190   CASE "Galvano","100-300Hz","150-200Hz"
2200     GOSUB Chart_var
2210     GOSUB Init_chart
2220     GOSUB Oscselect
2230     OUTPUT @File;"No, Freq[Hz], A, B"
2240     SELECT Type$(Typeno)
2250     CASE "Galvano"
2260       Freq_min=20 !100
2270       Freq_max=200  !1000
2280       Freq_step=1
2290     CASE "100-300Hz"
2300       Freq_min=100
2310       Freq_max=300
2320       Freq_step=1
2330     CASE "150-200Hz"
2340       Freq_min=150
2350       Freq_max=200
2360       Freq_step=.1
2370     END SELECT 
2380     Freq=Freq_min
2390     Count=0
2400     Freq_p=0
2410     FOR Freq=Freq_min TO Freq_max STEP Freq_step   !5
2420       Count=Count+1
2430       OUTPUT @Lcr;"FREQ:CW ";Freq      !command
2440       OUTPUT @Lcr;"FREQ:CW?"
2450       ENTER @Lcr;Freq_level
2460       IF Freq_level<>Freq_p THEN  !주파수가 종래와 같지 않으면
2470         GOSUB Reading
2480         PRINT "No.=";Count;",Freq=";Freq_level;"Hz,A=";A;",B=";B
2490         OUTPUT @File;Count,Freq_level,A,B
2500         Y(1)=A*10
2510         Y(2)=B+50
2520         CONTROL @Strip;SET("POINT LOCATION":Freq_level,"VALUES":Y(*))
2530         BEEP
2540         Freq_p=Freq_level
2550       END IF 
2560     NEXT Freq
2570     OUTPUT @Lcr;"VOLT:LEV 1V"         !init
2580   CASE "Freq St-Sp"
2590     GOSUB Oscselect
2600     OUTPUT @File;"No, Freq[Hz], A, B, Vm[V], Im[A]"
2610     Freq_min=1000 !100
2620     Freq_max=6000 !1000
2630     Freq=Freq_min
2640     Count=0
2650     FOR Freq=Freq_min TO Freq_max STEP 10 !5
2660       Count=Count+1
2670       OUTPUT @Lcr;"FREQ:CW ";Freq      !command
2680       OUTPUT @Lcr;"FREQ:CW?"
2690       ENTER @Lcr;Freq_level
2700       GOSUB Reading
2710       PRINT "No.=";Count;",Freq=";Freq_level;"Hz,A=";A;",B=";B
2720       OUTPUT @File;Count,Freq_level,A,B,Vm,Im
2730       BEEP
2740     NEXT Freq
2750     OUTPUT @Lcr;"VOLT:LEV 1V"         !init
2760   CASE "Freq-48 Sweep"
2770     GOSUB Oscselect
2780     GOSUB Freq48
2790     OUTPUT @File;"No, Freq[Hz], A, B, Vm[V], Im[A]"
2800     FOR I=1 TO 48
2810       OUTPUT @Lcr;"FREQ:CW ";Freq48(I)
2820       GOSUB Reading
2830       PRINT "No.=";I;",Freq=";Freq48(I);"Hz,A=";A;",B=";B
2840       OUTPUT @File;I,Freq48(I),A,B,Vm,Im
2850       BEEP
2860     NEXT I
2870     OUTPUT @Lcr;"VOLT:LEV 1V"         !init
2880   CASE "Freq 1k-1M"
2890     GOSUB Oscselect
2900     GOSUB Freq1k1m_read
2910     OUTPUT @File;"No, Freq[Hz], A, B, Vm[V], Im[A]"
2920     FOR I=1 TO 279
2930       OUTPUT @Lcr;"FREQ:CW ";Freq1k1m(I)
2940       GOSUB Reading
2950       PRINT "No.=";I;",Freq=";Freq1k1m(I);"Hz,A=";A;",B=";B
2960       OUTPUT @File;I,Freq1k1m(I),A,B,Vm,Im
2970       BEEP
2980     NEXT I
2990     OUTPUT @Lcr;"VOLT:LEV 1V"         !init
3000   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3010   CASE "DC Bias Sweep"
3020   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3030     OUTPUT @Lcr;"BIAS:VOLT:LEV? MIN"
3040     ENTER @Lcr;Bias_min
3050     OUTPUT @Lcr;"BIAS:VOLT:LEV? MAX"
3060     ENTER @Lcr;Bias_max
3070     OUTPUT @Lcr;"BIAS:STAT ON"  ! DC BIAS ON
3080     Count=0
3090     Bias_type=5  !!1 2 3 4 5 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3100     SELECT Bias_type
3110     CASE 1  !DC bias Volt
3120       GOSUB Oscselect
3130       GOSUB Freqselect
3140       OUTPUT @File;"No, DC-Bias[V], A, B, Vm[V], Im[A]"
3150       FOR Bias=-40 TO +40 STEP .2            !0~5V NOP=100
3160         Count=Count+1
3170         OUTPUT @Lcr;"BIAS:VOLT:LEV ";Bias
3180         GOSUB Reading
3190         PRINT "No.=";Count;",Bias=";Bias;"V, A=";A;",B=";B
3200         OUTPUT @File;Count,Bias,A,B,Vm,Im
3210         BEEP
3220       NEXT Bias
3230     CASE 2  !DC bias Curr
3240       GOSUB Oscselect
3250       GOSUB Freqselect
3260       OUTPUT @File;"No, DC-Bias[mA], A, B, Vm[V], Im[A]"
3270       FOR Bias=-.1 TO +.1 STEP .001               !-100mA~+100mA
3280         Count=Count+1
3290         OUTPUT @Lcr;"BIAS:CURR:LEV ";Bias    !command
3300         GOSUB Reading
3310         PRINT "No.=";Count;",Bias=";Bias;"A, A=";A;",B=";B
3320         OUTPUT @File;Count,Bias*1000,A,B,Vm,Im
3330         BEEP
3340       NEXT Bias
3350     CASE 5  !DC bias: -10V -1V 0V +0.25V +0.5V +1V
3360       DIM Bias_array(6)
3370       Bias_array(1)=-10
3380       Bias_array(2)=-1
3390       Bias_array(3)=0
3400       Bias_array(4)=.25
3410       Bias_array(5)=.5
3420       Bias_array(6)=1
3430       OUTPUT @Lcr;"FREQ 1MHZ"    !1MHz osc   !!!!!!!!!!!!!!!
3440       OUTPUT @Lcr;"VOLT 0.02V"   !20mV osc  !!!!!!!!!!!!!!!!!
3450       OUTPUT @File;"No, DC-Bias[V], Z[ohm], Phase[deg]"
3460       FOR I=1 TO 6 STEP 1
3470         OUTPUT @Lcr;"BIAS:VOLT:LEV ";Bias_array(I)
3480         GOSUB Reading
3490         PRINT "No.=";I;",Bias=";Bias_array(I);"V, Z=";A;",Phase=";B
3500         OUTPUT @File;I,Bias_array(I),A,B
3510         BEEP
3520       NEXT I
3530     CASE 3  !DC bias Volt + 1MHz C
3540       GOSUB Oscselect
3550       GOSUB Freqselect
3560       Count=0
3570       OUTPUT @File;"No, DC-Bias[V], A, B, Vm[V], Im[A]"
3580       FOR Bias=10 TO 1 STEP -1
3590         Count=Count+1
3600         OUTPUT @Lcr;"BIAS:VOLT:LEV ";-Bias
3610         GOSUB Reading
3620         PRINT "No.=";Count;",Bias=";-Bias;"V, A=";A;",B=";B
3630         OUTPUT @File;Count,-Bias,A,B,Vm,Im
3640         BEEP
3650       NEXT Bias
3660       FOR Bias=.9 TO .1 STEP -.1
3670         Count=Count+1
3680         OUTPUT @Lcr;"BIAS:VOLT:LEV ";-Bias
3690         GOSUB Reading
3700         PRINT "No.=";Count;",Bias=";-Bias;"V, A=";A;",B=";B
3710         OUTPUT @File;Count,-Bias,A,B,Vm,Im
3720         BEEP
3730       NEXT Bias
3740       FOR Bias=.09 TO .01 STEP -.01
3750         Count=Count+1
3760         OUTPUT @Lcr;"BIAS:VOLT:LEV ";-Bias
3770         GOSUB Reading
3780         PRINT "No.=";Count;",-Bias=";Bias;"V, A=";A;",B=";B
3790         OUTPUT @File;Count,-Bias,A,B,Vm,Im
3800         BEEP
3810       NEXT Bias
3820       FOR Bias=.009 TO 0. STEP -.001
3830         Count=Count+1
3840         OUTPUT @Lcr;"BIAS:VOLT:LEV ";-Bias
3850         GOSUB Reading
3860         PRINT "No.=";Count;",Bias=";-Bias;"V, A=";A;",B=";B
3870         OUTPUT @File;Count,-Bias,A,B,Vm,Im
3880         BEEP
3890       NEXT Bias
3900       !!!!!!!!!!!!!!!!!! + 바이어스
3910       FOR Bias=.001 TO .009 STEP .001
3920         Count=Count+1
3930         OUTPUT @Lcr;"BIAS:VOLT:LEV ";Bias
3940         GOSUB Reading
3950         PRINT "No.=";Count;",Bias=";Bias;"V, A=";A;",B=";B
3960         OUTPUT @File;Count,Bias,A,B,Vm,Im
3970         BEEP
3980       NEXT Bias
3990       FOR Bias=.01 TO .09 STEP .01
4000         Count=Count+1
4010         OUTPUT @Lcr;"BIAS:VOLT:LEV ";Bias
4020         GOSUB Reading
4030         PRINT "No.=";Count;",Bias=";Bias;"V, A=";A;",B=";B
4040         OUTPUT @File;Count,Bias,A,B,Vm,Im
4050         BEEP
4060       NEXT Bias
4070       FOR Bias=.1 TO 1. STEP .01
4080         Count=Count+1
4090         OUTPUT @Lcr;"BIAS:VOLT:LEV ";Bias
4100         GOSUB Reading
4110         PRINT "No.=";Count;",Bias=";Bias;"V, A=";A;",B=";B
4120         OUTPUT @File;Count,Bias,A,B,Vm,Im
4130         BEEP
4140       NEXT Bias
4150     CASE 4  !DC bias Curr + Freq Sweep  !diode
4160       GOSUB Oscselect
4170       OUTPUT @File;"No, DC-Bias[A], Freq[Hz], A, B, Vm[V], Im[A]"
4180       FOR Bias=-.1 TO +.101 STEP .002       !!!!!!!!!!!!!!-100mA~+100mA
4190         Count=0
4200         Freq_p=0
4210         OUTPUT @Lcr;"BIAS:CURR:LEV ";Bias    !command
4220         FOR Freq=150 TO 200 STEP .1    !!!!!!!!!!!!!!!!!!!!!
4230           OUTPUT @Lcr;"FREQ:CW ";Freq  !command
4240           OUTPUT @Lcr;"FREQ:CW?"
4250           ENTER @Lcr;Freq_level
4260           IF Freq_p<>Freq_level THEN
4270             Count=Count+1
4280             Freq_p=Freq_level
4290         !   WAIT 1
4300             GOSUB Reading
4310             PRINT "No.=";Count;"Bias=";Bias*1000;"mA, Freq=";Freq_level;"Hz,A=";A;",B=";B
4320             OUTPUT @File;Count,Bias,Freq_level,A,B,Vm,Im
4330             BEEP
4340           END IF 
4350         NEXT Freq
4360       NEXT Bias
4370     END SELECT 
4380     OUTPUT @Lcr;"BIAS:VOLT:LEV 0V"           !command
4390     OUTPUT @Lcr;"BIAS:STAT OFF" ! DC BIAS OFF
4400   CASE "Osc Level Sweep"
4410     GOSUB Freqselect
4420     OUTPUT @File;"No, Osc-Level[V], A, B, Vm[V], Im[A]"
4430     OUTPUT @Lcr;"VOLT:LEV? MIN"
4440     ENTER @Lcr;Osc_min    !5mV
4450     OUTPUT @Lcr;"VOLT:LEV? MAX"
4460     ENTER @Lcr;Osc_max    !20V
4470     Osc_octv=20
4480     Osc=Osc_min
4490     Count=0
4500     LOOP
4510       Count=Count+1
4520       OUTPUT @Lcr;"VOLT:LEV ";Osc        !command
4530       Osc=Osc*10^(1/Osc_octv)
4540       OUTPUT @Lcr;"VOLT:LEV?"
4550       ENTER @Lcr;Osc_level
4560       GOSUB Reading
4570       PRINT "No.=";Count;",Osc=";Osc_level;"V,A=";A;",B=";B
4580       OUTPUT @File;Count,Osc_level,A,B,Vm,Im
4590       BEEP
4600     EXIT IF Osc>Osc_max
4610     END LOOP 
4620     OUTPUT @Lcr;"VOLT:LEV 1V"          !init
4630   CASE "Osc Spk"
4640     OUTPUT @File;"No, Freq[Hz], A, B, Vm[V], Im[A]"
4650     OUTPUT @Lcr;"VOLT:LEV? MIN"
4660     ENTER @Lcr;Osc_min    !5mV
4670     OUTPUT @Lcr;"VOLT:LEV? MAX"
4680     ENTER @Lcr;Osc_max    !20V
4690     Osc_min=.01   !10mV
4700     Osc_max=10    !100mV 이어폰인경우
4710     Osc_octv=5    !=5
4720     Osc=Osc_min
4730     Freq_octv=75  !=75
4740     Freq_min=100
4750     Freq_max=10000
4760     Count=0
4770     LOOP
4780       OUTPUT @Lcr;"VOLT:LEV ";Osc        !command
4790       Osc=Osc*10^(1/Osc_octv)
4800       OUTPUT @Lcr;"VOLT:LEV?"
4810       ENTER @Lcr;Osc_level
4820       PRINT "No.=";Count;",Osc=";Osc_level
4830       OUTPUT @File;Count,Osc_level,Osc_level
4840       Freq=Freq_min
4850       LOOP
4860         Count=Count+1
4870         IF Freq>Freq_max THEN Freq=Freq_max
4880         OUTPUT @Lcr;"FREQ:CW ";Freq   !command
4890         Freq=Freq*10^(1/Freq_octv)
4900         OUTPUT @Lcr;"FREQ:CW?"
4910         ENTER @Lcr;Freq_level
4920         GOSUB Reading
4930         PRINT "No.=";Count;",Freq=";Freq_level;"Hz,A=";A;",B=";B
4940         OUTPUT @File;Count,Freq_level,A,B,Vm,Im
4950         BEEP
4960       EXIT IF Freq>=Freq_max*1.01
4970       END LOOP 
4980       BEEP
4990     EXIT IF Osc>Osc_max*1.01
5000     END LOOP 
5010     OUTPUT @Lcr;"VOLT:LEV 1V"          !init
5020   CASE "Time Sweep"  !몇 초 간격으로 몇 회
5030     INTEGER Nop,L1,L2
5040     Msg$="시간간격 [ms]"
5050     DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
5060     IF Btn=-1 OR Btn=1 THEN STOP
5070     Period=VAL(String$)
5080     Msg$="측정횟수     "
5090     DIALOG "STRING",Msg$,Btn;RETURN("VALUE":String$)
5100     IF Btn=-1 OR Btn=1 THEN STOP
5110     Nop=VAL(String$)
5120     GOSUB Freqselect
5130     OUTPUT @File;"No, Time[S], A, B, Vm[V], Im[A]"
5140     Count=0
5150     T0=TIMEDATE
5160     T=TIMEDATE-T0       !second.
5170     LOOP
5180       Count=Count+1
5190       GOSUB Reading
5200       T1=Period/1000.*(Count-1)
5210       PRINT "No.=";Count;",Time=";T1;"s,A=";A;",B=";B
5220       OUTPUT @File;Count,T,A,B,Vm,Im
5230       BEEP
5240       LOOP
5250         T=TIMEDATE-T0         !second.
5260         IF T>3276.7 THEN
5270           L1=INT(T)
5280           L2=INT(Period/1000)
5290         ELSE 
5300           L1=INT(T*10)
5310           L2=INT(Period/100)
5320         END IF 
5330       EXIT IF (L1 MOD L2)=0
5340       END LOOP 
5350     EXIT IF Count=Nop
5360     END LOOP 
5370   CASE "TCC"
5380     ASSIGN @Su TO 701
5390     GOSUB Freqselect
5400     GOSUB Oscselect
5410     OUTPUT @File;"No, Time[m], Temp['C], A, B, Vm[V], Im[A]"
5420     Count=0
5430     Temp0=0
5440     T0=TIMEDATE
5450     LOOP
5460       T1=TIMEDATE-T0  !초단위
5470       OUTPUT @Su;"TEMP?"
5480       WAIT .1
5490       ENTER @Su;Temp,Tmp,Tmp,Tmp
5500       IF Temp0<>Temp THEN   !온도차이가 0.1도 이상 발생되면 LCR 값을 측정한다.
5510         Count=Count+1
5520         GOSUB Reading       !A,B,Vm,Im
5530         PRINT "No.=";Count;" Time=";T1;"s, Temp=";Temp;"'C, A=";A;", B=";B
5540         OUTPUT @File;T1/60.,Temp,A,B,Vm,Im
5550       END IF 
5560       Temp0=Temp
5570     END LOOP 
5580     OUTPUT @Su;"POWER,OFF"
5590   CASE "TC Freq Sweep"
5600     GOSUB Oscselect
5610     OUTPUT @File;"No, Freq[Hz], A, B, Vm[V], Im[A]"
5620     ASSIGN @Su TO 701
5630     OUTPUT @Su;"MODE,CONSTANT"
5640     Freq_min=100  !100
5650     Freq_max=300  !1000
5660     Count=0
5670     FOR Temp_set=-20 TO 150 STEP 10
5680       OUTPUT @Su;"TEMP,S";Temp_set     !해당온도로 세팅
5690       Set=0
5700       LOOP
5710         OUTPUT @Su;"TEMP?"
5720         WAIT .1
5730         ENTER @Su;Temp,Tmp,Tmp,Tmp
5740         IF Temp=Temp_set THEN
5750           Set=1
5760           WAIT 100     !100초동안 기다린다.
5770         END IF 
5780         IF Set=1 THEN
5790           OUTPUT @Su;"TEMP?"
5800           WAIT .1
5810           ENTER @Su;Temp,Tmp,Tmp,Tmp
5820         END IF 
5830       EXIT IF Set=1
5840       END LOOP       !현재 온도가 세팅온도가 되면 루프에서 탈출
5850       OUTPUT @File;Temp,"'C"
5860       FOR Freq=Freq_min TO Freq_max STEP 1  !5
5870         Count=Count+1
5880         OUTPUT @Lcr;"FREQ:CW ";Freq     !command
5890         OUTPUT @Lcr;"FREQ:CW?"
5900         ENTER @Lcr;Freq_level
5910         GOSUB Reading
5920         PRINT "No.=";Count;",Freq=";Freq_level;"Hz,A=";A;",B=";B
5930         OUTPUT @File;Count,Freq_level,A,B,Vm,Im
5940       NEXT Freq
5950     NEXT Temp_set
5960     OUTPUT @Su;"POWER,OFF"
5970   END SELECT 
5980   RETURN
5990 Funcselect:!
6000   INTEGER Func_size,Func_length,Funcno
6010   Func_size=20       !문자열 배열의 크기
6020   Func_length=5      !문자열의 길이
6030   ALLOCATE Funcdis$(Func_size)[Func_length]
6040   DATA "Cp-D","Cp-Q","Cp-G","Cp-Rp","Cs-D","Cs-Q","Cs-Rs"
6050   DATA "Lp-Q","Lp-D","Lp-G","Lp-Rp","Ls-D","Ls-Q","Ls-Rs"
6060   DATA "R-X","Z-deg","Z-rad","G-B","Y-deg","Y-rad"
6070   FOR I=1 TO Func_size
6080     READ Funcdis$(I)
6090   NEXT I
6100   ALLOCATE Func$(Func_size)[Func_length]
6110   DATA "CPD","CPQ","CPG","CPRP","CSD","CSQ","CSRS"
6120   DATA "LPQ","LPD","LPG","LPRP","LSD","LSQ","LSRS"
6130   DATA "RX","ZTD","ZTR","GB","YTD","YTR"
6140   FOR I=1 TO Func_size
6150     READ Func$(I)
6160   NEXT I
6170   Msg$="테스트 종류를 선택하십시오."
6180   DIALOG "LIST",Msg$,Btn;SET("ITEMS":Funcdis$(*),"COLUMNS":Func_length,"ROWS":Func_size),RETURN("SELECTION":Funcno)
6190   IF Btn=-1 OR Btn=1 THEN STOP
6200   Funcno=Funcno+1
6210   OUTPUT @Lcr;"FUNC:IMP:TYPE ";TRIM$(Func$(Funcno))
6220   RETURN
6230 Oscselect:  !
6240   INTEGER Osc_size,Osc_length,Oscno
6250   Osc_size=12        !문자열 배열의 크기
6260   Osc_length=5       !문자열의 길이
6270   ALLOCATE Oscdis$(Osc_size)[Osc_length]
6280   Oscdis$(1)="0.02V"  !diode
6290   Oscdis$(2)="0.05V"
6300   Oscdis$(3)="0.1V"
6310   Oscdis$(4)="0.5V"
6320   Oscdis$(5)="1V"
6330   Oscdis$(6)="5V"
6340   Oscdis$(7)="6V"
6350   Oscdis$(8)="7V"
6360   Oscdis$(9)="7.1V"
6370   Oscdis$(10)="7.3V"
6380   Oscdis$(11)="10V"
6390   Msg$="측정 전압을 선택하십시요"
6400   DIALOG "LIST",Msg$,Btn;SET("ITEMS":Oscdis$(*),"COLUMNS":Osc_length,"ROWS":Osc_size),RETURN("SELECTION":Oscno)
6410   IF Btn=-1 OR Btn=1 THEN STOP
6420   Oscno=Oscno+1
6430   OUTPUT @Lcr;"VOLT ";TRIM$(Oscdis$(Oscno))
6440   RETURN
6450 Freqselect:  !
6460   INTEGER Freq_size,Freq_length,Freqno
6470   Freq_size=6        !문자열 배열의 크기
6480   Freq_length=5      !문자열의 길이
6490   ALLOCATE Freqdis$(Freq_size)[Freq_length]
6500   Freqdis$(1)="1KHZ"
6510   Freqdis$(2)="1MHZ"
6520   Freqdis$(3)="214HZ"
6530   Freqdis$(4)="330HZ"
6540   Freqdis$(5)="355HZ"
6550   Freqdis$(6)="173HZ"
6560   Msg$="주파수를 선택하십시오."
6570   DIALOG "LIST",Msg$,Btn;SET("ITEMS":Freqdis$(*),"COLUMNS":Freq_length,"ROWS":Freq_size),RETURN("SELECTION":Freqno)
6580   IF Btn=-1 OR Btn=1 THEN STOP
6590   Freqno=Freqno+1
6600   OUTPUT @Lcr;"FREQ ";TRIM$(Freqdis$(Freqno))
6610   RETURN
6620 Freq48:   !
6630   DIM Freq48(48)
6640   DATA 20,25,30,40,50,60,80
6650   DATA 100,120,150,200,250,300,400,500,600,800
6660   DATA 1000,1200,1500,2000,2500,3000,4000,5000,6000,8000
6670   DATA 10000,12000,15000,20000,25000,30000,40000,50000,60000,80000
6680   DATA 100000,120000,150000,200000,250000,300000,400000,500000,600000,800000
6690   DATA 1000000
6700   FOR I=1 TO 48
6710     READ Freq48(I)
6720   NEXT I
6730   RETURN
6740 Freq1k1m_read:   !
6750   DIM Freq1k1m(279)
6760   DATA 1,1.00806,1.01351,1.01695,1.02459,1.0274,1.03448,1.04167,1.05263,1.05634
6770   DATA 1.05932,1.07143,1.07759,1.08696,1.0909,1.09649,1.10294,1.11111,1.11607,1.1194
6780   DATA 1.13208,1.13637,1.15385,1.15741,1.17188,1.17647,1.17925,1.19048,1.2,1.20192
6790   DATA 1.20968,1.22449,1.22549,1.22951,1.25,1.27119,1.27551,1.2766,1.2931,1.30208
6800   DATA 1.30435,1.31579,1.32979,1.33929,1.3587,1.36364,1.38889,1.39535,1.41509,1.42045
6810   DATA 1.42857,1.44231,1.45349,1.46341,1.47059,1.4881,1.5,1.52439,1.53061,1.53846
6820   DATA 1.5625,1.57895,1.59574,1.60256,1.62612,1.63043,1.64474,1.66667,1.68919,1.70455
6830   DATA 1.71429,1.73611,1.74419,1.76471,1.78571,1.81818,1.82927,1.83824,1.875,1.89394
6840   DATA 1.92308,1.93548,1.95313,1.97368,2,2.01613,2.02703,2.06897,2.08333,2.14286
6850   DATA 2.15517,2.20588,2.22222,2.23214,2.27273,2.30769,2.31481,2.34375,2.4,2.40385
6860   DATA 2.41935,2.5,2.58621,2.60417,2.6087,2.67857,2.71739,2.72727,2.77778,2.84091
6870   DATA 2.85714,2.88462,2.97619,3,3.125,3.15789,3.26087,3.28947,3.33333,3.40909
6880   DATA 3.47222,3.52942,3.57143,3.67647,3.75,3.90625,3.94737,4,4.16667,4.28571
6890   DATA 4.41176,4.46429,4.61538,4.6875,4.80769,5,5.17241,5.20833,5.21739,5.35714
6900   DATA 5.43478,5.45455,5.55556,5.68182,5.71429,5.76923,5.95238,6,6.25,6.31579
6910   DATA 6.52174,6.57895,6.66666,6.81818,6.94444,7.05882,7.14286,7.35294,7.5,7.8125
6920   DATA 7.89474,8,8.33333,8.57243,8.82352,8.92857,9.23077,9.375,9.61538,10
6930   DATA 10.3448,10.4167,10.4348,10.7143,10.8696,10.9091,11.1111,11.3636,11.4286,11.5385
6940   DATA 11.9048,12,12.5,12.6316,13.0435,13.1579,13.3333,13.6364,13.8889,14.1176
6950   DATA 14.2857,14.7059,15,15.625,15.7895,16,16.6667,17.1429,17.6471,17.8571
6960   DATA 18.4615,18.75,19.2308,20,20.6897,20.8333,20.8696,21.4286,21.7391,21.8182
6970   DATA 22.2222,22.7272,22.8571,23.0769,23.8095,24,25,25.2632,26.087,26.3158
6980   DATA 26.6667,27.2727,27.7778,28.2353,28.5714,29.4118,30,31.25,31.5789,32
6990   DATA 33.3333,34.2857,35.2941,35.7143,36.9231,37.5,38.4615,40,41.6667,42.8571
7000   DATA 43.6364,45.4545,46.1538,48,50,53.3333,54.5455,55.5556,60,62.5
7010   DATA 66.6666,68.5714,72.4286,75,80,83.3333,85.7143,96,100,120
7020   DATA 125,150,160,166.667,200,240,250,300,320,333.333
7030   DATA 400,480,500,600,640,666.667,800,960,1000
7040   RESTORE 6760
7050   FOR I=1 TO 279
7060     READ Freq1k1m(I)
7070     Freq1k1m(I)=Freq1k1m(I)*1000.
7080     PRINT Freq1k1m(I)
7090   NEXT I
7100   RETURN
7110 Reading:   !A,B,Vm,Im
7120   OUTPUT @Lcr;"TRIGGER:IMMEDIATE"
7130   OUTPUT @Lcr;"FETC:IMP?"
7140   ENTER @Lcr;A,B,Status
7150 ! OUTPUT @Lcr;"FETC:SMON:VAC?"
7160 ! ENTER @Lcr;Vm
7170 ! OUTPUT @Lcr;"FETC:SMON:IAC?"
7180 ! ENTER @Lcr;Im
7190   RETURN
7200 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7210 Chart_var:   !
7220   SELECT Type$(Typeno)
7230   CASE "150-200Hz"  !
7240     X_origin=150
7250     X_range=50
7260     X_axis_label$="Frequency[Hz]"
7270     Y_origin=.1
7280     Y_range=100
7290     Y_axis_label$="A value"
7300   CASE "100-300Hz"  !
7310     X_origin=100
7320     X_range=200
7330     X_axis_label$="Frequency[Hz]"
7340     Y_origin=.1
7350     Y_range=100
7360     Y_axis_label$="A value"
7370   CASE ELSE 
7380     X_origin=LOG(20)/LOG(10)
7390     X_range=6
7400     X_axis_label$="Frequency log[Hz]"
7410     Y_origin=.1
7420     Y_range=10
7430     Y_axis_label$="A value"
7440   END SELECT 
7450   RETURN
7460 Init_chart:   !
7470   DIM X_axis_label$[25],Y_axis_label$[25]
7480   INTEGER Trace_num
7490   INTEGER Screen_dims(1:2),Gwindow_dims(1:4)
7500   REAL Y(1:2)   !Y(1)=A, Y(2)=B
7510   GESCAPE CRT,36;Screen_dims(*) ! Get screen width and height.
7520  !
7530  ! Set the dimensions of the graphics window using GESCAPE 33 so
7540  ! that it is centered on the screen.
7550  !
7560   Gwindow_dims(1)=Screen_dims(1)*.25 ! X of upper left.
7570   Gwindow_dims(2)=Screen_dims(2)*.2  ! Y of upper left.
7580   Gwindow_dims(3)=Screen_dims(1)*.7  ! Width.
7590   Gwindow_dims(4)=Screen_dims(2)*.6  ! Height.
7600   GESCAPE CRT,33;Gwindow_dims(*)     ! Set graphics window geometry.
7610  !
7620   GESCAPE CRT,35 ! Move the graphics window to the top.
7630  !
7640  ! Create a stripchart.  Make it invisible until all changes are made.
7650  !
7660   ASSIGN @Strip TO WIDGET "STRIPCHART";SET("VISIBLE":0)
7670  !
7680  ! Set the overall attributes.
7690  !
7700   CONTROL @Strip;SET("TITLE":"Data Logger")
7710   CONTROL @Strip;SET("MINIMUM SCROLL":2)
7720   CONTROL @Strip;SET("MOVABLE":0)
7730   CONTROL @Strip;SET("MAXIMIZABLE":0)
7740   CONTROL @Strip;SET("X":0,"Y":0)
7750  !
7760  ! Size the stripchart to exactly fill the graphics window.
7770  !
7780   Vert_borders=26
7790   Horiz_borders=8
7800   Height=Gwindow_dims(4)-Vert_borders
7810   Width=Gwindow_dims(3)-Horiz_borders
7820   CONTROL @Strip;SET("WIDTH":Width,"HEIGHT":Height)
7830  !
7840   CONTROL @Strip;SET("CURRENT AXIS":"X")
7850   CONTROL @Strip;SET("ORIGIN":X_origin,"RANGE":X_range)
7860   CONTROL @Strip;SET("AXIS LABEL":X_axis_label$)
7870  !CONTROL @Strip;SET("DIGITS":5)
7880  !
7890   CONTROL @Strip;SET("CURRENT AXIS":"Y")
7900   CONTROL @Strip;SET("ORIGIN":Y_origin,"RANGE":Y_range)
7910   CONTROL @Strip;SET("AXIS LABEL":Y_axis_label$)
7920  !
7930   CONTROL @Strip;SET("VISIBLE":1) ! Show the stripchart.
7940  !
7950   RETURN
7960   END
7970   SUB Errors
7980     DIM Err$[50]
7990     Sp=SPOLL(717)
8000     IF BIT(Sp,5) THEN
8010       OUTPUT 717;"*ESR?"
8020       ENTER 717;Esr
8030       PRINT "Event Status Resister = ";Esr
8040       LOOP
8050         OUTPUT 717;"SYST:ERR?"
8060         ENTER 717;Err$
8070       EXIT IF VAL(Err$)=0
8080         PRINT Err$
8090       END LOOP 
8100     END IF 
8110     ENABLE INTR 7;2
8120   SUBEND