

10 '  **************************************************************
20 '  *  Program example IECEXAM1.BAS                              *
30 '  *  Readout of measured values via bus                        *
40 '  *  2-channel meas. of rms, input peak, frequency and phase   *
50 '  *  Setup for this example: EXAM1.SAC (Actual Setup Mode)     *
60 '  **************************************************************
70 '
80 Upl=20: '                       Bus-Address
90 IEC TERM 10: IEC TIME 5000: '   terminator and timeout
100 IEC OUT Upl,"MMEM:LOAD:STAT 0,'C:\UPL\IEC_EXAM\EXAM1.SAC'";
110 IEC OUT Upl,"init;*wai": '     trigger and wait for termination
120 '     reading of measured values
130 '     ! Attention: you can read out only those values !
140 '     ! which are set active in the analyzer !
150 IEC OUT Upl,"sens:data?": '    ask for function value channel 1
160 IEC IN Upl,Func1$: '           read out of function value channel 1
170 IEC OUT Upl,"sens2:data?": '   ask for Inp Peak value channel 1
180 IEC IN Upl,Peak1$: '           read out of Input Peak value channel 1
190 IEC OUT Upl,"sens3:data?": '   ask for frequency value channel 1
200 IEC IN Upl,Freq1$: '           read out of frequency value channel 1
210 IEC OUT Upl,"sens4:data?": '   ask for phase value
220 IEC IN Upl,Phase$: '           read out of phase value
230 IEC OUT Upl,"sens:data2?": '   ask for function value channel 2
240 IEC IN Upl,Func2$: '           read out of funktion value channel 2
250 IEC OUT Upl,"sens2:data2?": '  ask for Inp Peak value channel 2
260 IEC IN Upl,Peak2$: '           read out of input Peak value channel 2
270 '
280 '    Example for printout of results
290 PRINT TAB(10);"Function";TAB(30);"Input Peak";TAB(50);"Frequency"
300 PRINT "CH1";TAB(10);Func1$;TAB(30);Peak1$;TAB(50);Freq1$
310 PRINT "CH2";TAB(10);Func2$;TAB(30);Peak2$;TAB(50);Phase$
320 '    with following line you can ask UPL for syntax errors (wo REM)
330 REM IEC OUT Upl,"syst:err?": IEC IN Upl,W$: PRINT W$
