TR6143-bas
10 ! Advantest TR6143
20 ! 2020-01-08 30 ! 기능 및 범위: V3,V4,V5,V6 = 320mV 3.2V 32V 110V(default) 40 ! I-1, I0, I1, I2, I3, I4 = 32uA 320uA 3.2mA 32mA 320mA 2A 50 ! 0.01mV~110V 60 ! 입력숫자: D + dddd unit, 예 D + 0500.0 MA 70 ! 출력 on/off E, H 80 ! response mode slow/fast RP0, PR1 90 ! integration time 10ms, 1PLC, 10PLC, 100PLC = IT2, IT3, IT4, IT5 100 OPTION BASE 1 110 GOSUB Battery_select 120 GOSUB Fileopen 130 GOSUB Inst_open 140 GOSUB Stimulus_select 150 GOSUB Measure 160 ! GOSUB Inst_close 170 GOSUB Fileclose 180 STOP 190 Measure: ! 200 INTEGER Count,I 210 DIM Cmd$[25],A1$[14],A2$[14],Test$[1] 220 OUTPUT @File;"No.,Time[m],Volt[V],Curr[A]" 230 GOSUB Chart_var 240 GOSUB Init_chart 250 Wait=.001 !계측기 세팅을 한 후, 첫 측정에서 측정값이 0이 나오는 현상 때문에 잠시 대기 시간 260 T0=TIMEDATE 270 Count=0 280 FOR I=1 TO 200 !배터리 충방전실험을 5회 실시 290 GOSUB Cycle 300 NEXT I 310 RETURN 320 Cycle: ! 330 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 340 !충전. 정전류, 전압제한(전압을 읽는다.) 350 !전류 전압을 +로 표기한다. 360 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 370 Test$="C" 380 Cmd$="I4" !2A range 390 Cmd$=Cmd$&" D"&VAL$(Ic)&"A" !D1.0A 400 Cmd$=Cmd$&" D"&VAL$(Vc)&"V" !D4.2V 410 OUTPUT @Src;Cmd$ !"I4 D1A D4.2V" 420 OUTPUT @Src;"E" !Operate ON 430 WAIT Wait 440 Pre_v=0 450 LOOP 460 Time=(TIMEDATE-T0)/60 470 GOSUB Reading 480 Volt=Data 490 Curr=Ic 500 IF Data>Pre_v THEN !측정값이 직전값보다 크면 510 GOSUB Data_process 520 END IF 530 EXIT IF Volt>=Vc !측정 전압이 충전최고 전압에 도달하면 540 END LOOP 550 OUTPUT @Src;"H" !Operate OFF 560 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 570 !충전, 충전 최고전압에 도달하면. 정전압, 전류제한(전류를 읽는다.) 580 !전류 전압을 +로 표기한다. 590 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 600 Test$="C" 610 Cmd$="V5" !32V range 620 Cmd$=Cmd$&" D"&VAL$(Vc)&"V" !D4.2V 630 Cmd$=Cmd$&" D"&VAL$(Ic)&"A" !D1.0A 640 OUTPUT @Src;Cmd$ !"V5 D 4.2V D 1.0A" 650 OUTPUT @Src;"E" !Operate ON 660 WAIT Wait 670 Pre_v=Curr 680 LOOP 690 Time=(TIMEDATE-T0)/60 700 GOSUB Reading !충전전압에 도달되어, 흐르는 전류를 측정한다. 710 Curr=Data 720 Volt=Vc 730 IF Data<Pre_v THEN !측정값이 직전값보다 작으면 740 GOSUB Data_process 750 END IF 760 EXIT IF Curr<=Ic_end !현재 전류가 종료전류에 도달하면 770 END LOOP 780 OUTPUT @Src;"H" !Operate OFF 790 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 800 !방전 전류는 - 이다 810 !전류 전압을 +로 표기한다. 820 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 830 !charge volt limit=Vc 840 Test$="D" 850 Cmd$="I4" !2A range 860 Cmd$=Cmd$&" D"&VAL$(Id)&"A" !D-1.0A 870 Cmd$=Cmd$&" D"&VAL$(Vc)&"V" !D4.2V 880 OUTPUT @Src;Cmd$ !"I4 D1A D4.2V" 890 OUTPUT @Src;"E" !Operate ON 900 WAIT Wait 910 Pre_v=Vc 920 LOOP 930 Time=(TIMEDATE-T0)/60 940 GOSUB Reading !일정 전류 방전 , 전압이 측정된다. 950 Volt=Data 960 Curr=Id 970 IF Data<Pre_v THEN !측정값이 직전값보다 작으면 980 GOSUB Data_process 990 END IF 1000 EXIT IF Volt<=Vd !현재 전압이 충전전압에 도달하면 1010 END LOOP 1020 OUTPUT @Src;"H" !Operate OFF 1030 RETURN 1040 Data_process: ! 1050 Count=Count+1 1060 Y1=(Volt/Vc)*100 !전압 [%] 1070 Y2=(Curr/Ic)*100 !전류 [%] 1080 !IF Test$="C" THEN 1090 ! Y(1)=-Y1 1100 ! Y(2)=-Y2 1110 !ELSE !"D" 1120 Y(1)=Y1 1130 Y(2)=Y2 1140 !END IF 1150 CONTROL @Strip;SET("POINT LOCATION":Time,"VALUES":Y(*)) 1160 PRINT "Count=";Count;", T=";PROUND(Time,-4);"m, V=";Volt;"V, I=";Curr;"A" 1170 OUTPUT @File;Count,PROUND(Time,-4),Volt,Curr 1180 Pre_v=Data 1190 RETURN 1191 Reading: ! 1192 LOOP 1193 GOSUB Reading1 1194 EXIT IF Data<>0 1195 END LOOP 1196 RETURN 1200 Reading1: ! 1210 ! 전압을 측정하면 나타나는 데이터 포맷 1220 ! 12345678901234 1230 !"DV +03.857E+0" 원래 1240 !" DV +03.857E+0" 앞에 공백이 하나 추가되어 나온 적이 있다. 1250 ! 전압를 측정하면 나타나는 데이터 포맷 1260 ! 12345678901234 1270 !"DI +0.6310E+0" 원래 1280 ENTER @Src;A1$ 1290 A2$=TRIM$(A1$) !앞뒤 공백 모두 없앤다 1300 Data=VAL(A2$[3,13]) 1310 ! Data=PROUND(Data,-3) !소수점 3자리. 0.1mA까지 측정되면 너무 많은 데이터가 획득되므로 1320 Data=DROUND(Data,3) !유효수자 3자리 1330 RETURN 1340 Fileopen: ! 1350 DIM Filename$[20],Dhms$[8] 1360 Time$=TIME$(TIMEDATE) !하루가 늦게 계산되므로 하루 추가 +24*3600 1370 Date$=DATE$(TIMEDATE) 1380 Dhms$=Date$[1;2]&Time$[1;2]&Time$[4;2]&Time$[7;2] 1390 Filename$=Dhms$&".txt" 1400 CREATE Filename$,1 1410 ASSIGN @File TO Filename$;FORMAT ON 1420 RETURN 1430 Fileclose:! 1440 ASSIGN @File TO * 1450 RETURN 1460 Battery_select: ! 1470 DIM Msg$[25] 1480 INTEGER Size,Length,Btn,Battery_no 1490 Size=4 1500 Length=6 1510 ALLOCATE Battery$(Size)[Length] 1520 Battery$(1)="Li" 1530 Battery$(2)="NiCd" 1540 Battery$(3)="3-NiCd" 1550 Battery$(4)="EDLC" 1560 Msg$="배터리 종류" 1570 DIALOG "LIST",Msg$,Btn;SET("ITEMS":Battery$(*),"COLUMNS":Length,"ROWS":Size),RETURN("SELECTION":Battery_no) 1580 Battery_no=Battery_no+1 1590 RETURN 1600 Inst_close:! 1610 OUTPUT @Src;"H" !Operate OFF 1620 RETURN 1630 Inst_open: ! 1640 ASSIGN @Src TO 714 !advantest TR6143 1650 RETURN 1660 Stimulus_select: ! 1670 SELECT Battery$(Battery_no) 1680 CASE "Li" 1690 Vc=4.2 !4.2V 충전전압 1700 Vd=3.7 !3.2V 방전종료전압 1710 Ic=2 !100mA 충전전류 1720 Ic_end=1 !충전 종료 전류 1730 Id=-2 !100mA 방전전류 음수 1740 CASE "NiCd" !표준 1.2V 1750 Vc=1.3 !1.5V 충전전압 1760 Vd=.9 !0.9V 방전종료전압 1770 Ic=.001 !100mA 충전전류 1780 Ic_end=.0005 !충전 종료 전류 1790 Id=-.0001 !100mA 방전전류 음수 1800 CASE "3-NiCd" !표준 3.6V 1810 Vc=4.7 !4.1V 충전전압 1820 Vd=1.5 !3.1V 방전종료전압 1830 Ic=.0005 !100mA 충전전류 1840 Ic_end=.00035 !충전 종료 전류 1850 Id=-5.E-5 !100mA 방전전류 음수 1860 CASE "" 1870 Msg$="충전전류[A], 방전전류[A], 충전종료전류[A], " 1880 END SELECT 1890 !GOSUB Dialog_string3 1900 RETURN 1910 Chart_var: ! 1920 X_origin=0 !time=0 1930 X_range=12*60 !1 hours *60min 1940 X_axis_label$="Elapsed Time [Min]" 1950 Y_origin=-110 1960 Y_range=220 1970 Y_axis_label$="Volt & Current [%]" 1980 RETURN 1990 Init_chart: ! 2000 DIM X_axis_label$[25],Y_axis_label$[25] 2010 INTEGER Trace_num 2020 INTEGER Screen_dims(1:2),Gwindow_dims(1:4) 2030 REAL Y(1:2) !Y(1) Volt, Y(2) Current 2040 GESCAPE CRT,36;Screen_dims(*) ! Get screen width and height. 2050 ! 2060 ! Set the dimensions of the graphics window using GESCAPE 33 so 2070 ! that it is centered on the screen. 2080 ! 2090 Gwindow_dims(1)=Screen_dims(1)*.25 ! X of upper left. 2100 Gwindow_dims(2)=Screen_dims(2)*.2 ! Y of upper left. 2110 Gwindow_dims(3)=Screen_dims(1)*.7 ! Width. 2120 Gwindow_dims(4)=Screen_dims(2)*.6 ! Height. 2130 GESCAPE CRT,33;Gwindow_dims(*) ! Set graphics window geometry. 2140 ! 2150 GESCAPE CRT,35 ! Move the graphics window to the top. 2160 ! 2170 ! Create a stripchart. Make it invisible until all changes are made. 2180 ! 2190 ASSIGN @Strip TO WIDGET "STRIPCHART";SET("VISIBLE":0) 2200 ! 2210 ! Set the overall attributes. 2220 ! 2230 CONTROL @Strip;SET("TITLE":"Data Logger") 2240 CONTROL @Strip;SET("MINIMUM SCROLL":2) 2250 CONTROL @Strip;SET("MOVABLE":0) 2260 CONTROL @Strip;SET("MAXIMIZABLE":0) 2270 CONTROL @Strip;SET("X":0,"Y":0) 2280 ! 2290 ! Size the stripchart to exactly fill the graphics window. 2300 ! 2310 Vert_borders=26 2320 Horiz_borders=8 2330 Height=Gwindow_dims(4)-Vert_borders 2340 Width=Gwindow_dims(3)-Horiz_borders 2350 CONTROL @Strip;SET("WIDTH":Width,"HEIGHT":Height) 2360 ! 2370 CONTROL @Strip;SET("CURRENT AXIS":"X") 2380 CONTROL @Strip;SET("ORIGIN":X_origin,"RANGE":X_range) 2390 CONTROL @Strip;SET("AXIS LABEL":X_axis_label$) 2400 !CONTROL @Strip;SET("DIGITS":5) 2410 ! 2420 CONTROL @Strip;SET("CURRENT AXIS":"Y") 2430 CONTROL @Strip;SET("ORIGIN":Y_origin,"RANGE":Y_range) 2440 CONTROL @Strip;SET("AXIS LABEL":Y_axis_label$) 2450 ! 2460 CONTROL @Strip;SET("VISIBLE":1) ! Show the stripchart. 2470 ! 2480 RETURN 2490 END