Other topics about Sample Programs
This sample program demonstrates how to perform limit tests.
The sample program creates a limit table as shown in the following two tables, turns on the Limit Test feature, performs one cycle of measurement, and then displays the test results.
No. |
Type |
Begin Stimulus |
End Stimulus |
Begin Response |
End Response |
1 |
MAX |
847.5 MHz |
905.0 MHz |
-55.0 dBm |
-55.0 dBm |
2 |
MIN |
935.0 MHz |
960.0 MHz |
-3.5 dBm |
-3.5 dBm |
3 |
MAX |
935.0 MHz |
960.0 MHz |
0 dBm |
0 dBm |
4 |
MAX |
980.0 MHz |
1047.5 MHz |
-25.0 dBm |
-25.0 dBm |
See Limit Test for this programming.
10 DIM Param1$[9],Param2$[9],Fmt1$[9],Fmt2$[9],Buff$[9]
20 REAL Cent,Span,Lim1(1:4,1:5),Lim2(1:3,1:5),Fail_data(1:1601)
30 INTEGER Num_of_seg1,Num_of_seg2,Segment,Column,Fail_point
40 !
50 ASSIGN @Agte507x TO 717
60 !
70 Cent=9.475E+8
80 Span=2.00E+8
90 Param1$="S21"
100 Param2$="S11"
110 Fmt1$="MLOG"
120 Fmt2$="MLOG"
130 !
140 ! == Trace 1 Limit Line ==
150 Num_of_seg1=4 ! Number of segments: 4
160 ! -- Segment 1 --
170 Lim1(1,1)=1 ! Type : Maximum
180 Lim1(1,2)=8.475E+8 ! Frequency Start: 847.5 MHz
190 Lim1(1,3)=9.050E+8 ! Stop : 905.0 MHz
200 Lim1(1,4)=-55 ! Response Start: -55 dBm
210 Lim1(1,5)=-55 ! Stop : -55 dBm
220 ! -- Segment 2 --
230 Lim1(2,1)=2 ! Type : Minimum
240 Lim1(2,2)=9.350E+8 ! Frequency Start: 935.0 MHz
250 Lim1(2,3)=9.600E+8 ! Stop : 960.0 MHz
260 Lim1(2,4)=-3.5 ! Response Start: -3.5 dBm
270 Lim1(2,5)=-3.5 ! Stop : -3.5 dBm
280 ! -- Segment 3 --
290 Lim1(3,1)=1 ! Type : Maximum
300 Lim1(3,2)=9.350E+8 ! Frequency Start: 935.0 MHz
310 Lim1(3,3)=9.600E+8 ! Stop : 960.0 MHz
320 Lim1(3,4)=0 ! Response Start: 0 dBm
330 Lim1(3,5)=0 ! Stop : 0 dBm
340 ! -- Segment 4 --
350 Lim1(4,1)=1 ! Type : Maximum
360 Lim1(4,2)=9.800E+8 ! Frequency Start: 980.0 MHz
370 Lim1(4,3)=1.0475E+9 ! Stop : 1047.5 MHz
380 Lim1(4,4)=-25 ! Response Start: -25 dBm
390 Lim1(4,5)=-25 ! Stop : -25 dBm
400 ! == Trace 2 Limit Line ==
410 Num_of_seg2=3 ! Number of segments: 3
420 ! -- Segment 1 --
430 Lim2(1,1)=1 ! Type : Maximum
440 Lim2(1,2)=8.475E+8 ! Frequency Start: 847.5 MHz
450 Lim2(1,3)=9.250E+8 ! Stop : 925.0 MHz
460 Lim2(1,4)=0 ! Response Start: 0 dBm
470 Lim2(1,5)=0 ! Stop : 0 dBm
480 ! -- Segment 2 --
490 Lim2(2,1)=1 ! Type : Maximum
500 Lim2(2,2)=9.350E+8 ! Frequency Start: 935.0 MHz
510 Lim2(2,3)=9.600E+8 ! Stop : 960.0 MHz
520 Lim2(2,4)=-9.5 ! Response Start: -9.5 dBm
530 Lim2(2,5)=-9.5 ! Stop : -9.5 dBm
540 ! -- Segment 3 --
550 Lim2(3,1)=1 ! Type : Maximum
560 Lim2(3,2)=9.700E+8 ! Frequency Start: 970.0 MHz
570 Lim2(3,3)=1.0475E+9 ! Stop : 1047.5 MHz
580 Lim2(3,4)=0 ! Response Start: 0 dBm
590 Lim2(3,5)=0 ! Stop : 0 dBm
600 !
610 OUTPUT @Agte507x;":SENS1:FREQ:CENT ";Cent
620 OUTPUT @Agte507x;":SENS1:FREQ:SPAN ";Span
630 OUTPUT @Agte507x;":CALC1:PAR1:COUN 2"
640 OUTPUT @Agte507x;":DISP:WIND1:SPL D1_2"
650 OUTPUT @Agte507x;":TRIG:SOUR BUS"
660 OUTPUT @Agte507x;":INIT1:CONT ON"
670 !
680 ! Trace 1
690 !
700 OUTPUT @Agte507x;":CALC1:PAR1:SEL"
710 !
720 OUTPUT @Agte507x;":CALC1:PAR1:DEF "&Param1$
730 OUTPUT @Agte507x;":CALC1:FORM "&Fmt1$
740 !
750 OUTPUT @Agte507x;":CALC1:LIM:DATA ";Num_of_seg1;
760 FOR Segment=1 TO Num_of_seg1
770 FOR Column=1 TO 5
780 OUTPUT @Agte507x;",";Lim1(Segment,Column);
790 NEXT Column
800 NEXT Segment
810 OUTPUT @Agte507x;""
820 OUTPUT @Agte507x;":CALC1:LIM:DISP ON"
830 OUTPUT @Agte507x;":CALC1:LIM ON"
840 !
850 ! Trace 2
860 !
870 OUTPUT @Agte507x;":CALC1:PAR2:SEL"
880 !
890 OUTPUT @Agte507x;":CALC1:PAR2:DEF "&Param2$
900 OUTPUT @Agte507x;":CALC1:FORM "&Fmt2$
910 !
920 OUTPUT @Agte507x;":CALC1:LIM:DATA ";Num_of_seg2;
930 FOR Segment=1 TO Num_of_seg2
940 FOR Column=1 TO 5
950 OUTPUT @Agte507x;",";Lim2(Segment,Column);
960 NEXT Column
970 NEXT Segment
980 OUTPUT @Agte507x;""
990 OUTPUT @Agte507x;":CALC1:LIM:DISP ON"
1000 OUTPUT @Agte507x;":CALC1:LIM ON"
1010 !
1020 ! Setting status registers
1030 !
1040 OUTPUT @Agte507x;":STAT:QUES:LIM:CHAN1:ENAB 6"
1050 OUTPUT @Agte507x;":STAT:QUES:LIM:CHAN1:PTR 6"
1060 OUTPUT @Agte507x;":STAT:QUES:LIM:CHAN1:NTR 0"
1070 OUTPUT @Agte507x;":STAT:QUES:LIM:PTR 2"
1080 OUTPUT @Agte507x;":STAT:QUES:LIM:NTR 0"
1090 OUTPUT @Agte507x;"*CLS"
1100 !
1110 OUTPUT @Agte507x;":TRIG:SING"
1120 OUTPUT @Agte507x;"*OPC?"
1130 ENTER @Agte507x;Buff$
1140 !
1150 ! Checking test results
1160 !
1170 OUTPUT @Agte507x;":STAT:QUES:LIM?"
1180 ENTER @Agte507x;Reg_val
1190 Ch1_judge=BIT(Reg_val,1)
1200 OUTPUT @Agte507x;":STAT:QUES:LIM:CHAN1?"
1210 ENTER @Agte507x;Reg_val
1220 Tr1_judge=BIT(Reg_val,1)
1230 Tr2_judge=BIT(Reg_val,2)
1240 !
1250 ! Displaying test results
1260 !
1270 IF Ch1_judge=0 THEN
1280 PRINT "## PASS! ##"
1290 ELSE
1300 PRINT "## FAIL! ##"
1310 IF Tr1_judge=0 THEN
1320 PRINT " Trace1(S21): PASS"
1330 ELSE
1340 PRINT " Trace1(S21): FAIL"
1350 !
1360 ! Reading and displaying frequency at failed points
1370 !
1380 OUTPUT @Agte507x;":CALC1:PAR1:SEL"
1390 OUTPUT @Agte507x;":CALC1:LIM:REP:POIN?"
1400 ENTER @Agte507x;Fail_point
1410 REDIM Fail_data(1:Fail_point)
1420 OUTPUT @Agte507x;":CALC1:LIM:REP?"
1430 ENTER @Agte507x;Fail_data(*)
1440 PRINT " Frequency:"
1450 FOR I=1 TO Fail_point
1460 PRINT USING "3X,MD.4DE";Fail_data(I)
1470 NEXT I
1480 END IF
1490 IF Tr2_judge=0 THEN
1500 PRINT " Trace2(S11): PASS"
1510 ELSE
1520 PRINT " Trace2(S11): FAIL"
1530 !
1540 ! Reading and displaying frequency at failed points
1550 !
1560 OUTPUT @Agte507x;":CALC1:PAR2:SEL"
1570 OUTPUT @Agte507x;":CALC1:LIM:REP:POIN?"
1580 ENTER @Agte507x;Fail_point
1590 REDIM Fail_data(1:Fail_point)
1600 OUTPUT @Agte507x;":CALC1:LIM:REP?"
1610 ENTER @Agte507x;Fail_data(*)
1620 PRINT " Frequency:"
1630 FOR I=1 TO Fail_point
1640 PRINT USING "3X,MD.4DE";Fail_data(I)
1650 NEXT I
1660 END IF
1670 END IF
1680 END
Line 50
Assigns a GPIB address to the I/O pass.
Lines 70 to 120
These lines store the sweep center value, sweep span value, trace 1 measurement parameter, trace 2 measurement parameter, trace 1 data format, and trace 2 data format into the variables Cent, Span, Param1$, Param2$, Fmt1$, and Fmt2$, respectively.
Line 150
Stores the number of segments in trace 1 limit table into the Num_of_seg1 variable.
Lines 160 to 390
These lines store the settings in trace 1 limit table into the Lim1(*) variable.
Line 410
Stores the number of segments in trace 2 limit table into the Num_of_seg2 variable.
Lines 420 to 590
These lines store the settings in trace 2 limit table into the Lim2(*) variable.
Lines 610 to 620
These lines configure the sweep range for channel 1's sweep range using the center and span values contained in the Cent and Span values.
Lines 630 to 660
These lines configure channel 1 so that it contains 2 traces, displays graphs in two windows tiled horizontally (i.e., with the screen split into upper and lower halves), uses a bus trigger source, and works in continuous activation mode.
Line 700
Sets channel 1's active trace to trace 1.
Lines 720 to 730
These lines store trace 1's measurement parameter and data format into the variables Param1$ and Fmt1$, respectively.
Lines 750 to 810
These lines set up the limit table for trace 1.
Line 750: Sends the command that sets up a limit table along with the Num_of_seg1 variable that contains the number of segments.
Lines 770 to 790: Sends five data items (type, start point stimulus value, end point stimulus value, start point response value, and end point response value) for each segment.
Lines 820 to 830
These lines turn on the display of limit lines and the Limit Test feature for trace 1.
Line 870
Sets channel 1's active trace to trace 2.
Lines 890 to 900
These lines set trace 2's measurement parameter and data format to Param2$ and Fmt2$, respectively.
Lines 920 to 980
These lines set up the limit table for trace 2.
Lines 990 to 1000
These lines turn on the display of limit lines and the Limit Test feature for trace 2.
Lines 1040 to 1060
These lines set, under the questionable limit channel 1 status register, the enable register and positive transition filter to 6 (0000000000000110 in binary notation) while setting the negative transition filter to 0 so that the questionable limit status condition register's bit 1 is set to 1 when the test result that combines the results for trace 1 and trace 2 is "fail."
The sample program provides an example of explicitly configuring the register bits so that they reflect the test results that only cover trace 1 and trace 2. However, because the results for traces 3 to 9 will never be "fail" as long as the Limit Test feature is disabled for those traces, the register bits would reflect the test result that is limited to traces 1 and 2, even if the default setting is not changed.
Lines 1070 to 1080
These lines set transition filters so that the questionable limit status event register's bit 1 is set to 1 when the questionable limit status condition register's bit 1 changes from 0 to 1.
Line 1090
Clears the questionable limit status event register and questionable limit channel 1 status event register.
Lines 1110 to 1130
These lines trigger the instrument and wait until the sweep cycle is completed.
Lines 1170 to 1190
These lines retrieve the value of the questionable limit status event register and store the setting of bit 1 of the value into Ch1_judge.
Lines 1200 to 1230
These lines retrieve the value of the questionable limit channel 1 status event register and store the settings of bit 1 and bit 2 of the value into Tr1_judge and Tr2_judge, respectively.
Line 1280
Displays a message indicating that the DUT has passed the limit test if the test result for channel 1 is "Pass" (i.e., if Ch1_judge returns 0).
Lines 1300 to 1660
These lines are executed if the test result for channel 1 is "Fail" (i.e., if Ch1_judge returns 1).
Line 1300: Notifies the user that the limit test result is "Fail".
Line 1320: Displays a message indicating that trace 1 has passed the limit test if the test result for trace 1 is "Pass" (i.e., if Tr1_judge returns 0).
Lines 1340 to 1470: These lines are executed if the test result for trace 1 is "Fail" (i.e., if Tr1_judge returns 1). The lines notify the user that the test result for trace 1 is "Fail" and then retrieve and display the frequencies at the failed measurement points on trace 1.
Line 1340: Notifies the user that the limit test result for trace 1 is "Pass."
Line 1380: Sets channel 1's active trace to trace 2.
Lines 1390 to 1410: These lines retrieve the number of failed measurement points on trace 1 and, based on that number, resize the array that contains retrieved frequencies.
Lines 1420 to 1470: These lines retrieve and display the frequencies at the failed measurement points on trace 1.
Line 1500: Displays a message indicating that trace 2 has passed the limit test if the test result for trace 2 is "Pass" (i.e., if Tr2_judge returns 0).
Lines 1520 to 1650: If the test result for trace 2 is "Fail" (i.e., if Tr2_judge returns 1), these lines notify the user that trace 2 has failed to pass the limit test and then retrieve and display the frequencies at the failed measurement points on trace 2.