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=.2 !계측기 세팅을 한 후, 첫 측정에서 측정값이 0이 나오는 현상 때문에 잠시 대기 시간 260 T0=TIMEDATE 270 Count=0 280 FOR I=1 TO 5 !배터리 충방전실험을 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 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 560 !충전, 충전 최고전압에 도달하면. 정전압, 전류제한(전류를 읽는다.) 570 !전류 전압을 -로 표기한다. 580 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 590 Test$="C" 600 Cmd$="V5" !32V range 610 Cmd$=Cmd$&" D "&VAL$(Vc)&"V" !D4.2V 620 Cmd$=Cmd$&" D "&VAL$(Ic)&"A" !D1.0A 630 OUTPUT @Src;Cmd$ !"V5 D 4.2V D 1.0A" 640 OUTPUT @Src;"E" !Operate ON 650 WAIT Wait 660 Pre_v=Curr 670 LOOP 680 Time=(TIMEDATE-T0)/60 690 GOSUB Reading !충전전압에 도달되어, 흐르는 전류를 측정한다. 700 Curr=Data 710 Volt=Vc 720 IF Data<Pre_v THEN !측정값이 직전값보다 작으면 730 GOSUB Data_process 740 END IF 750 EXIT IF Curr<Ic_end !현재 전류가 종료전류에 도달하면 760 END LOOP 770 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 780 !방전 790 !전류 전압을 +로 표기한다. 800 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 810 !charge volt limit=Vc 820 Test$="D" 830 Cmd$="I4" !2A range 840 Cmd$=Cmd$&" D "&VAL$(-Id)&"A" !D-1.0A 850 Cmd$=Cmd$&" D "&VAL$(Vc)&"V" !D4.2V 860 OUTPUT @Src;Cmd$ !"I4 D1A D4.2V" 870 OUTPUT @Src;"E" !Operate ON 880 WAIT Wait 890 Pre_v=Vc 900 LOOP 910 Time=(TIMEDATE-T0)/60 920 GOSUB Reading !일정 전류 방전 , 전압이 측정된다. 930 Volt=Data 940 Curr=Id 950 IF Data<Pre_v THEN !측정값이 직전값보다 작으면 960 GOSUB Data_process 970 END IF 980 EXIT IF Volt<Vd !현재 전압이 충전전압에 도달하면 990 END LOOP 1000 RETURN 1010 Data_process: ! 1020 Count=Count+1 1030 Y1=(Volt/Vc)*100 !전압 [%] 1040 Y2=(Curr/Ic)*100 !전류 [%] 1050 IF Test$="C" THEN 1060 Y(1)=-Y1 1070 Y(2)=-Y2 1080 ELSE !"D" 1090 Y(1)=Y1 1100 Y(2)=Y2 1110 END IF 1120 CONTROL @Strip;SET("POINT LOCATION":Time,"VALUES":Y(*)) 1130 PRINT "Count=";Count;", T=";PROUND(Time,-4);"m, V=";Volt;"V, I=";Curr;"A" 1140 OUTPUT @File;Count,PROUND(Time,-4),Volt,Curr 1150 Pre_v=Data 1160 RETURN 1170 Reading: ! 1180 ! 전압을 측정하면 나타나는 데이터 포맷 1190 ! 12345678901234 1200 !"DV +03.857E+0" 원래 1210 !" DV +03.857E+0" 앞에 공백이 하나 추가되어 나온 적이 있다. 1220 ! 전압를 측정하면 나타나는 데이터 포맷 1230 ! 12345678901234 1240 !"DI +0.6310E+0" 원래 1250 ENTER @Src;A1$ 1260 A2$=TRIM$(A1$) !앞뒤 공백 모두 없앤다 1270 Data=VAL(A2$[3,13]) 1280 Data=PROUND(Data,-3) !특히 mA단위까지만 나오도록, 0.1mA까지 측정되면 너무 많은 데이터가 획득되므로 1290 RETURN 1300 Fileopen: ! 1310 DIM Filename$[20],Dhms$[8] 1320 Time$=TIME$(TIMEDATE) !하루가 늦게 계산되므로 하루 추가 +24*3600 1330 Date$=DATE$(TIMEDATE) 1340 Dhms$=Date$[1;2]&Time$[1;2]&Time$[4;2]&Time$[7;2] 1350 Filename$=Dhms$&".txt" 1360 CREATE Filename$,1 1370 ASSIGN @File TO Filename$;FORMAT ON 1380 RETURN 1390 Fileclose:! 1400 ASSIGN @File TO * 1410 RETURN 1420 Battery_select: ! 1430 DIM Msg$[25] 1440 INTEGER Size,Length,Btn,Battery_no 1450 Size=3 1460 Length=4 1470 ALLOCATE Battery$(Size)[Length] 1480 Battery$(1)="Li" 1490 Battery$(2)="NiCd" 1500 Battery$(3)="EDLC" 1510 Msg$="배터리 종류" 1520 DIALOG "LIST",Msg$,Btn;SET("ITEMS":Battery$(*),"COLUMNS":Length,"ROWS":Size),RETURN("SELECTION":Battery_no) 1530 Battery_no=Battery_no+1 1540 RETURN 1550 Inst_close:! 1560 OUTPUT @Src;"H" !Operate OFF 1570 RETURN 1580 Inst_open: ! 1590 ASSIGN @Src TO 714 !advantest TR6143 1600 RETURN 1610 Stimulus_select: ! 1620 SELECT Battery$(Battery_no) 1630 CASE "Li" 1640 Vc=4.2 !4.2V 충전전압 1650 Vd=3.2 !3.2V 방전종료전압 1660 Ic=2 !100mA 충전전류 1670 Ic_end=.1 !충전 종료 전류 1680 Id=2 !100mA 방전전류 1690 CASE "NiCd" 1700 Vc=1.5 !1.5V 충전전압 1710 Vd=.9 !0.9V 방전종료전압 1720 Ic=.001 !100mA 충전전류 1730 Ic_end=.0001 !충전 종료 전류 1740 Id=.1 !100mA 방전전류 1750 CASE "" 1760 Msg$="충전전류[A], 방전전류[A], 충전종료전류[A], " 1770 END SELECT 1780 !GOSUB Dialog_string3 1790 RETURN 1800 Chart_var: ! 1810 X_origin=0 !time=0 1820 X_range=2*60 !24 hours 1830 X_axis_label$="Elapsed Time [Min]" 1840 Y_origin=-110 1850 Y_range=220 1860 Y_axis_label$="Volt & Current [%]" 1870 RETURN 1880 Init_chart: ! 1890 DIM X_axis_label$[25],Y_axis_label$[25] 1900 INTEGER Trace_num 1910 INTEGER Screen_dims(1:2),Gwindow_dims(1:4) 1920 REAL Y(1:2) !Y(1) Volt, Y(2) Current 1930 GESCAPE CRT,36;Screen_dims(*) ! Get screen width and height. 1940 ! 1950 ! Set the dimensions of the graphics window using GESCAPE 33 so 1960 ! that it is centered on the screen. 1970 ! 1980 Gwindow_dims(1)=Screen_dims(1)*.25 ! X of upper left. 1990 Gwindow_dims(2)=Screen_dims(2)*.2 ! Y of upper left. 2000 Gwindow_dims(3)=Screen_dims(1)*.7 ! Width. 2010 Gwindow_dims(4)=Screen_dims(2)*.6 ! Height. 2020 GESCAPE CRT,33;Gwindow_dims(*) ! Set graphics window geometry. 2030 ! 2040 GESCAPE CRT,35 ! Move the graphics window to the top. 2050 ! 2060 ! Create a stripchart. Make it invisible until all changes are made. 2070 ! 2080 ASSIGN @Strip TO WIDGET "STRIPCHART";SET("VISIBLE":0) 2090 ! 2100 ! Set the overall attributes. 2110 ! 2120 CONTROL @Strip;SET("TITLE":"Data Logger") 2130 CONTROL @Strip;SET("MINIMUM SCROLL":2) 2140 CONTROL @Strip;SET("MOVABLE":0) 2150 CONTROL @Strip;SET("MAXIMIZABLE":0) 2160 CONTROL @Strip;SET("X":0,"Y":0) 2170 ! 2180 ! Size the stripchart to exactly fill the graphics window. 2190 ! 2200 Vert_borders=26 2210 Horiz_borders=8 2220 Height=Gwindow_dims(4)-Vert_borders 2230 Width=Gwindow_dims(3)-Horiz_borders 2240 CONTROL @Strip;SET("WIDTH":Width,"HEIGHT":Height) 2250 ! 2260 CONTROL @Strip;SET("CURRENT AXIS":"X") 2270 CONTROL @Strip;SET("ORIGIN":X_origin,"RANGE":X_range) 2280 CONTROL @Strip;SET("AXIS LABEL":X_axis_label$) 2290 !CONTROL @Strip;SET("DIGITS":5) 2300 ! 2310 CONTROL @Strip;SET("CURRENT AXIS":"Y") 2320 CONTROL @Strip;SET("ORIGIN":Y_origin,"RANGE":Y_range) 2330 CONTROL @Strip;SET("AXIS LABEL":Y_axis_label$) 2340 ! 2350 CONTROL @Strip;SET("VISIBLE":1) ! Show the stripchart. 2360 ! 2370 RETURN 2380 END