

10 '  **************************************************************
20 '  *  Program example EXAM6.BAS                                 *
30 '  *  Readout of FFT values                                     *
40 '  *  1-channel FFT with limit check of values                  *
50 '  *  Setup for this example: EXAM6.SAC (Actual Setup Mode)     *
60 '  **************************************************************
70 '
100  UPL OUT "MMEM:LOAD:STAT 0,'C:\UPL\B10_EXAM\EXAM6.SAC'"
110  UPL OUT "init:cont off": '     single sweep
120  UPL OUT "init;*wai": '         Trigger of FFT and wait for termination
130  UPL OUT "calc:lim:upp:stat on": 'switch limit check on
140  UPL OUT "calc:lim:on trac1": '   for channel 1
150  UPL OUT "calc:lim:upp:val -60 dbv": 'select values > -60dBV
160 ' only FFT-values above limit are stored in the trace buffer
170 ' so the amount of values can be reduced
180 ' (max 1023 values can be read out via bus!)
190 UPL OUT "trac:poin? trac1": '  ask for number of values
200 UPL IN W$: Poin=VAL(W$): '     Poin = number of measured values
210 PRINT "Number of measured values: ";Poin
220 DIM Lev(Poin),Freq(Poin): '        Dimension of results
230 UPL OUT "trac:data? trac1": '  ask for trace data chan el 1
240 UPL BLOCKIN Lev(0)
300 '
310 UPL OUT "trac:data? list1": '  ask for frequency data channel 1
320 UPL BLOCKIN Freq(0)
380 '
390 '    the results are now available in Lev(0) to Lev(Poin-1)
400 '    and the frequency values in Freq(1) to Freq(Poin)
410 '    all values are stored in basic units Volt or Hz
420 '    calculations of values have to consider this
430 '    the grafical display in the UPL is independend !
440 '
450 '  Example for printout all values
460 N=0
470 FOR I=0 TO Poin-1
480 PRINT USING "###";I+1;
490 PRINT TAB(10);USING "######.##";"Freq ";Freq(I);" Hz";
500 PRINT TAB(35);USING "####.#####";"Level ";Lev(I)*1000;" mV"
510 N=N+1: IF N=17 THEN INPUT "Press RETURN for more data!";X$: N=0
520 NEXT 
530 '    with following line you can ask UPL for syntax errors (wo REM)
540 REM  UPL OUT,"syst:err?":  UPL IN W$: PRINT W$
