Section 5 GPIB
5-40
(5) The following is a sample program that sets Input1, manual frequency 1 GHz, amplitude discrimination L3, 100 high-
speed samples, 100 µs high-speed period, and internal trigger, uses serial polling for high-speed sample measurement
with a 100 µs trigger delay to wait for measurement to end, and then reads the count value and converts it to a
frequency value.
1) Program example using N88–BASIC
10 '***SAMPLE PROGRAM5***
20 CMD DELIM=0:DIM CNT1#(100),CNT2#(100), FREQ#(100)
30 ADRS=8
40 ISET IFC
50 ISET REN
60 PRINT @ADRS;"*RST;*CLS;TRM 1" : Specifies presets, status clear, and terminator
70 PRINT @ADRS;"ACF 1;AF 1GHZ;ACL 1;AD 3" : Manual measurement and 1 GHz manual frequency
: Manual level measurement and manual level L3
80 PRINT @ADRS;"TRSSMP 100;TRSRT 100US" : 100 high-speed samples and 100 µs high-speed sample period
90 PRINT @ADRS;"TRG 1;TRGDLY 100US" : External trigger and 100 µs trigger delay
100 PRINT @ADRS;"TRS 1" : High-speed sample On
110 PRINT @ADRS;"ESE2 1" : Permits measurement end event status
120 PRINT @ADRS;"*CLS" : Status clear
130 PRINT@ADRS;"*TRG" : Trigger command
140 GOSUB *WAITMEND : Waits for measurement end
150 ' :
160 PRINT @ADRS;"TRSOFS?" : Reads high-speed sample offset frequency
170 INPUT @ADRS;OFS$
180 OFS#=VAL(OFS$)
190 PRINT @ADRS;"MTRS? 100" : Gets high-speed sample data
200 FOR I=1 TO 100
210 INPUT @ADRS;CNT1$,CNT2$
215 CNT1#(I)=VAL(CNT1$),CNT2#(I)=VAL(CNT2$)
220 IF OFS#<0 GOTO 250 : Distributes processing by offset frequency sign
230 FREQ#(I)=(CNT2#(I)/CNT1#(I))*1E+09+ABS(OFS#)
: When offset is positive
240 GOTO 260
250 FREQ#(I)=ABS(OFS#)(CNT2#(I)/CNT#(I))*1E+09
: When offset is negative
260 FREQ$=STR$(FREQ#(I))+"HZ" : Displays frequency value
270 PRINT FREQ$
280 NEXT I
290 PRINT @ADRS;"*RST"
300 END
310 *WAITMEND : Routine that waits for measurement to end
320 POLL ADRS,S : Serial polling
330 IF (S AND 4)=0 GOTO 320 : Checks that measurement ends
340 RETURN
350 END