User`s guide

Table Of Contents
Chapter 4 77
Performing a Calibration
Sample Program
4. Performing a Calibration
Example 4-2 ECal (ecal.htb)
10 DIM File$[20],Ch$[9],Inp_char$[9]
20 INTEGER Cal_kit,Cal_type,Port(1:2)
30 !
40 ASSIGN @Agte507x TO 717
50 File$="Ex_4_2.sta"
60 Ch$="1"
70 !
80 CLEAR SCREEN
90 ON ERROR GOTO Type_select
100 Type_select: !
110 PRINT "## Calibration Type Selection ##"
120 PRINT " 1: Full 1 Port"
130 PRINT " 2: Full 2 Port"
140 PRINT ""
150 PRINT "Input 1 to 2"
160 INPUT "Input number? (1 to 2)",Inp_char$
170 Cal_type=IVAL(Inp_char$,10)
180 IF Cal_type<1 OR Cal_type>2 THEN Type_select
190 OFF ERROR
200 !
210 Select_port(Cal_type,Port(*))
220 Ecal(@Agte507x,Ch$,Cal_type,Port(*))
230 !
240 OUTPUT @Agte507x;":MMEM:STOR:STYP CST"
250 OUTPUT @Agte507x;":MMEM:STOR """&File$&""""
260 END
270 !=============================================
280 ! Port Selection Function
290 !=============================================
300 SUB Select_port(INTEGER Num_of_ports,INTEGER Port(*))
310 DIM Inp_char$[9]
320 !
330 CLEAR SCREEN
340 IF Num_of_ports=2 THEN
350 Port(1)=1
360 Port(2)=2
370 ELSE
380 PRINT "## Test Ports Selection ##"
390 ON ERROR GOTO Port_select
400 FOR I=1 TO Num_of_ports
410 PRINT "Port("&VAL$(I)&"):";
420 Port_select: !
430 INPUT "Number?",Inp_char$
440 Port(I)=IVAL(Inp_char$,10)
450 IF Port(I)<1 OR Port(I)>2 THEN Port_select
460 FOR J=1 TO I-1
470 IF Port(I)=Port(J) THEN Port_select
480 NEXT J
490 PRINT Port(I)
500 NEXT I
510 OFF ERROR
520 END IF
530 SUBEND
540 !=============================================
550 ! Electronic Calibration Function
560 !=============================================
570 SUB Ecal(@Agte507x,Ch$,INTEGER Num_of_ports,INTEGER Port(*))
580 DIM Buff$[9],Err_msg$[100]
590 INTEGER Err_no,Port1
600 !
610 PRINT "## Full "&VAL$(Num_of_ports)&" Port ECal ##"