"54622-fr-bas.txt"의 두 판 사이의 차이
(새 문서: 54622A <pre> 10 !54622, freq response & THD chracteristics 20 !2017-02-16 30 OPTION BASE 1 40 INTEGER I,Count,Millivolt 50 DIM Filename$[20],Dhms$[8] 60 Ti...) |
(차이 없음)
|
2020년 8월 13일 (목) 12:00 기준 최신판
10 !54622, freq response & THD chracteristics 20 !2017-02-16 30 OPTION BASE 1 40 INTEGER I,Count,Millivolt 50 DIM Filename$[20],Dhms$[8] 60 Time$=TIME$(TIMEDATE) 70 Date$=DATE$(TIMEDATE) 80 Dhms$=Date$[1;2]&Time$[1;2]&Time$[4;2]&Time$[7;2] 90 Filename$=Dhms$&".txt" 100 CREATE Filename$,1 110 ASSIGN @File TO Filename$;FORMAT ON 120 ASSIGN @Osc TO 707 130 ASSIGN @Fg TO 710 140 ! OUTPUT @Osc;"*RST" 150 ! OUTPUT @Fg;"*RST" 160 CLEAR SCREEN 170 DIM Id$[125] 180 OUTPUT @Osc;"*IDN?" 190 ENTER @Osc;Id$ 200 PRINT Id$ 210 OUTPUT @Fg;"*IDN?" 220 ENTER @Fg;Id$ 230 PRINT Id$ 240 ! set up gernerator 250 OUTPUT @Fg;"FUNC:SHAP SIN" ! 260 OUTPUT @Fg;"OUTP:LOAD INF" ! or 50 270 OUTPUT @Fg;"VOLT:OFFS 0" 280 OUTPUT @Fg;"VOLT:UNIT VRMS" 290 ! set up osciiloscope 300 OUTPUT @Osc;":ACQ:COUN 1" 310 OUTPUT @Osc;":ACQ:TYPE AVER" 320 OUTPUT @Osc;":CHAN1:COUPling AC" 330 OUTPUT @Osc;":CHAN2:COUPling AC" 340 OUTPUT @Osc;":CHAN1:PROBe 1" !atten 1:1 350 OUTPUT @Osc;":CHAN2:PROBe 1" !atten 10:1 360 OUTPUT @Osc;":CHAN1:OFFS 0V" 370 OUTPUT @Osc;":CHAN2:OFFS 0V" 380 OUTPUT @Osc;":TRIG:MODE EDGE" 390 OUTPUT @Osc;":TRIG:NREJect ON" 400 OUTPUT @Osc;":TRIG:EDGE:SOUR CHAN1" 410 OUTPUT @Osc;":TRIG:EDGE:LEV 0" 420 OUTPUT @Osc;":TRIG:EDGE:REJect HF" 430 OUTPUT @Osc;":TRIG:EDGE:SLOPe POS" 440 OUTPUT @File;"No,Freq[Hz],Vin[V],Gain,THD[%]" 450 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 460 ! total harmonic distortion 470 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 480 Count=0 490 Harmonic=5 !from 1 to 5 500 ! set up osciiloscope FFT 510 OUTPUT @Osc;":FUNC:SOUR CHAN2" 520 OUTPUT @Osc;":FUNC:OPER FFT" 530 OUTPUT @Osc;":FUNC:OFFS -20" 540 OUTPUT @Osc;":FUNC:SCAL 50" 550 Freq_step=1 !per octave 560 Freq=100 570 LOOP 580 EXIT IF Freq>10000 !100Hz~200,000Hz 590 Period=1/Freq 600 OUTPUT @Osc;":TIMEBASE:SCALE ";Period/2 610 OUTPUT @Fg;"FREQ ";Freq 620 Scale1=.03 !function generator min Vrms 630 Scale2=Scale1/10 640 FOR Millivolt=50 TO 1500 STEP 50 !mv min=35.36 이보다 작으면 계측기에서 삐 650 Count=Count+1 660 Volt=Millivolt/1000. 670 OUTPUT @Fg;"VOLT ";Volt 680 OUTPUT @Osc;":CHAN1:SCALe ";Scale1 690 OUTPUT @Osc;":CHAN2:SCALe ";Scale2 700 LOOP ! autoscale 710 OUTPUT @Osc;":DIGITIZE CHAN1,CHAN2,MATH" 720 OUTPUT @Osc;":MEAS:VRMS? CHAN1" 730 ENTER @Osc;Vrms1 740 IF Vrms1>100 THEN Scale1=Scale1*2 750 OUTPUT @Osc;":MEAS:VRMS? CHAN2" 760 ENTER @Osc;Vrms2 770 IF Vrms2>100 THEN Scale2=Scale2*2 780 OUTPUT @Osc;":CHAN1:SCALe ";Scale1 790 OUTPUT @Osc;":CHAN2:SCALe ";Scale2 800 EXIT IF Vrms1<100 AND Vrms2<100 810 END LOOP 820 Sum=0 830 FOR I=1 TO Harmonic 840 Fft_span=Freq*2 850 Fft_cent=Freq*(2*I-1) 860 OUTPUT @Osc;":FUNC:CENT ";Fft_cent 870 OUTPUT @Osc;":FUNC:SPAN ";Fft_span 880 OUTPUT @Osc;":MEAS:VMAX? MATH" 890 ENTER @Osc;Dbv 900 PRINT Dbv; 910 IF I=1 THEN 920 Pri=10^(Dbv/20) 930 ELSE 940 Sum=Sum+(10^(Dbv/20))^2 950 END IF 960 NEXT I 970 Thd=SQRT(Sum/Pri)*100 980 Gain=Vrms2/Vrms1 990 PRINT Count;" F=";Freq;" THD=";INT(Thd*1000)/1000;" V1=";Vrms1;" Gain=";Gain 1000 OUTPUT @File;Count,Freq,Vrms1,Gain,Thd 1010 NEXT Millivolt 1020 Freq=Freq*10^(1/Freq_step) !xx-steps per octave 1030 END LOOP 1040 OUTPUT @Osc;":RUN" 1050 OUTPUT @Fg;"VOLT 0.1" 1060 FOR I=1 TO 5 1070 OUTPUT @Fg;"SYST:BEEP" 1080 WAIT .2 1090 NEXT I 1100 END