R3753BH
10 !채널 1,2 각가 AMPL. phase
20 GOSUB Declaration
30 GOSUB Fileopen
40 GOSUB Measure_select
50 GOSUB Network_setup
60 GOSUB Network_read
70 GOSUB Measure
80 GOSUB Fileclose
90 STOP
100 Declaration: !!!!!!!!!!!!!!!!
110 OPTION BASE 1
120 DIM Msg$[255]
130 INTEGER I,Nop,F_mode
140 RETURN
150 Measure_select: !!!!!!!!!!!!!!!!
160 ASSIGN @Na TO 711
170 OUTPUT @Na;"OLDC ON" !IEEE488.1-1987 command mode가 ON된다.
180 ! ASSIGN @Na_fmt_off TO 711;FORMAT OFF,SWAP ON
190 RETURN
200 !!!!!!!디바이스 개별에 따른 초기값 세팅 !!!!!!!
210 Network_setup: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
220 OUTPUT @Na;"*IDN?"
230 ENTER @Na;Msg$
240 DISP Msg$
250 ! OUTPUT @Na;"FORM3" ! FORMAT:DATA:REAL,64
260 OUTPUT @Na;"FORM0" ! ascii
270 RETURN
280 Network_read: ! 계측기 세팅값을 읽어드린다.
290 OUTPUT @Na;"LINFREQ?" !선형주파수 스윕 모드인가? 0=아니다. 1=그렇다.
300 ENTER @Na;F_mode
310 OUTPUT @Na;"STAR?" !시작주파수
320 ENTER @Na;F_start
330 OUTPUT @Na;"STOP?" !끝주파수
340 ENTER @Na;F_stop
350 OUTPUT @Na;"POIN?" !샘플링 수
360 ENTER @Na;Nop
370 ALLOCATE Freq(Nop),Form1(Nop),Form2(Nop) !NOP=max 1201
380 PRINT F_mode,F_start,F_stop,Nop
390 SELECT F_mode
400 CASE 0 !로그
410 K=(F_stop/F_start)^(1/(Nop-1))
420 FOR I=1 TO Nop
430 Freq(I)=F_start*K^(I-1)
440 NEXT I
450 CASE 1 !선형
460 F_span=F_stop-F_start
470 FOR I=1 TO Nop
480 Freq(I)=F_start+(F_span)/(Nop-1)*(I-1)
490 NEXT I
500 END SELECT
510 RETURN
520 Fileclose: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
530 ASSIGN @File TO *
540 OUTPUT @Na;"REM 0" !remote false 이 명령어를 수행해야 local 후 버튼이 동작한다.
550 ASSIGN @Na TO *
560 RETURN
570 Measure: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
580 ! OUTPUT @Na;"*OPC?"
590 ! OUTPUT @Na;"SINGLE"
600 ! ENTER @Na;Tmp
610 OUTPUT @Na;"OT1DFOR" !output trace / first wave/ data formatting
620 ! OUTPUT @Na;"OT1MFOR" !output trace / 1(~4) ch / memory formatting
630 ! ENTER @Na_fmt_off;Form(*)
640 ENTER @Na;Form1(*)
650 OUTPUT @Na;"OT2DFOR" !output trace / second wave / data formatting
660 ENTER @Na;Form2(*)
670 FOR I=1 TO Nop
680 DISP I,Freq(I),Form1(I),Form2(I)
690 OUTPUT @File;I,Freq(I),Form1(I),Form2(I)
700 NEXT I
710 RETURN
720 Fileopen: !
730 DIM Filename$[20],Dhms$[8]
740 Time$=TIME$(TIMEDATE)
750 Date$=DATE$(TIMEDATE)
760 Dhms$=Date$[1;2]&Time$[1;2]&Time$[4;2]&Time$[7;2]
770 Filename$=Dhms$&".txt"
780 CREATE Filename$,1
790 ASSIGN @File TO Filename$;FORMAT ON
800 RETURN
810 END