5-35
(2) The following is an example of a program that sets Input 2, 50 Ω impedance, 10 ms sample rate, 10 Hz resolution, Max
statistics processing and hold, uses a service request to wait for measurement to end, and then reads and displays the
statistics processing value.
1) Program example using N
88–BASIC
10'***SAMPLE PROGRAM2***
20 CMD DELIM=0
30 ADRS=8
40 ISET IFC : Interface clear
50 ISET REN : Remote enable
60 WBYTE &H14; : Device clear
70 PRINT @ADRS;"*RST;*CLS;TRM 1" : Sets presets, status clear, and terminator
80 PRINT @ADRS;"ESE2 2;*SRE 4" : Statistics processing end event status
: Statistics processing end event status
90 PRINT @ADRS;"INPCH 2" : Sets input channel Input2
100 PRINT @ADRS;"STS 2" : Sets Max statistics processing
110 PRINT @ADRS;"SMP 3;RES 4;SH 1" : Specifies 10 ms sample rate, 10 Hz resolution, hold
120 ON SRQ GOSUB *SRQMEND : Specifies routine during service request
130 '
140 '***MAIN ROUTINE***
150 SRQ ON : Permits service request
160 ENDFLG=0:CNT=0
170 PRINT @ADRS;"*CLS;*TRG" : Status clear and trigger command
180 ENDFLG=0
190 IF ENDFLG><1 GOTO 190
200 CNT=CNT+1
210 IF CNT<10 GOTO 170
220 END
230 '
240 '***SRQ ROUTINE*** : SRQ routine
250 *SRQMEND
260 POLL ADRS,S : Serial polling
270 IF (S AND 4)=0 GOTO 330 : Checks that measurement ends
280 PRINT @ADRS;"*CLS" : Status clear
290 PRINT @ADRS;"MSTA?" : Reads statistics processing
300 INPUT @ADRS;MAX$,MIN$
310 PRINT MAX&,MIN$ : Displays statistics processing
320 ENDFLG=1
330 SRQ ON
340 RETURN
350 END
5.6 Sample Programs