

10 '   ******************************************************************
20 '   * Example program EXAM2.BAS                                      *
30 '   * 1-channel frequency sweep measurement                          *
40 '   * with readout of measured values                                *
50 '   * Poin = number of measured points                               *
60 '   * Setup for this example: EXAM2.SAC (Actual Setup Mode!)         *
70 '   ******************************************************************
80 '
90 UPL OUT "MMEM:LOAD:STAT 0,'C:\UPL\B10_EXAM\EXAM2.SAC'": 'load setup
100 '
110 Poin=50: '                    Number of meas. points
120 DIM Result(Poin): '          dimension of results
130 DIM Freq(Poin): '            dimension of frequency values
140 UPL OUT "init:cont off": '   set single sweep
150 UPL OUT "init;*wai": '       triggern and wait for termination
160 UPL OUT "trac? trac1": '     ask for trace data channel 1
170 UPL BLOCKIN Result(1): '     read out of results beginning with 1
180 UPL OUT "sour:list:freq?": ' ask for frequency values of sweep
190 UPL BLOCKIN Freq(1): '       read out of frequencies beginning with 1
200 '  the results are now available in Result(1) to Result(Poin)
210 '  the frequencies in Freq(1) to Freq(Poin)
220 '  all values are stored in basic units eg in Volts with level meas.
230 '  calculations have to consider this !
240 '  the grafical display of UPL is independent !
250 '  Example for printout of the values 1...20
260 FOR I=1 TO 20 STEP 2
270 PRINT USING "######.##";"Freq";Freq(I);" Hz";
280 PRINT TAB(19);USING "###.####";"Level";Result(I);" V";
290 PRINT TAB(41);USING "######.##";"Freq";Freq(I+1);" Hz";
300 PRINT TAB(60);USING "###.####";"Level";Result(I+1);" V"
310 NEXT 
