5-33
5.6 Sample Programs
This section lists some sample programs for your reference. It has examples of using an NEC-standard GPIB board and
controlling with N88-BASIC and examples using an NI GPIB board and NI-488.2
TM
software and controlling with Visual
Basic.
(1) The following is an example of a program that sets CW, Auto measurement, sample rate of 1 s and resolution of 1 Hz
on Input1, uses serial polling to wait for measurement to end, and then reads and displays the frequency measurement
value.
1) Program example using N
88–BASIC
10'*** SAMPLE PROGRAM1***
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;TRM1" : Preset, status clear, and terminator settings
80 PRINT @ADRS;"ESE2 1" : Permits measurement end event status
90 PRINT @ADRS;"SMP 9;RES3" : Sets sample rate of 1 s and resolution of 1 Hz
100 PRINT @ADRS;"*CLS;*TRG" : Status clear and trigger command
110 FOR I=1 TO 10
120 GOSUB *WAITMEND : Waits for measurement to end
130 PRINT @ADRS;"MCW?" : Reads CW frequency value
140 INPUT @ADRS;FREQ$
150 PRINT FREQ$ : Displays CW frequency value
160 NEXT I
170 END
180 '*** WAIT MEASURE END*** : Routine for waiting for measurement end
190 *WAITMEND
200 POLL ADRS,S : Serial polling
210 IF (S AND 4)=0 GOTO 200 : Checks that measurement ends
220 PRINT @ADRS;"*CLS" : Status clear
230 RETURN
240 END
5.6 Sample Programs