2 - 10 GETTING STARTED WITH SCPI PROGRAMMING
2.5.1 How to make a single shot measurement
The MEASure? query allows you to make a single-shot measurement, and the
FETCh? query allows you to fetch more signal characteristics.
PROGRAM EXAMPLE:
’
*****
’Measure and print the AC-RMS, peak to peak, and amplitude of
’the signal on channel 1.
’
*****
response$ = SPACE$(30)
CALL Send (0, 8, "MEASure:AC? (@1)", 1) ’
Measures the AC-RMS value
CALL Receive (0, 8, response$, 256) ’
PRINT "AC-RMS value : "; LEFT$(response$, IBCNT% -1)
CALL Send (0, 8, "FETCh:PTPeak?", 1) ’
Fetches the Peak-To-Peak value
CALL Receive (0, 8, response$, 256) ’
PRINT "Peak-To-Peak value: "; LEFT$(response$, IBCNT% - 1)
CALL Send (0, 8, "FETCh:AMPLitude?", 1) ’
Fetches the amplitude value
CALL Receive (0, 8, response$, 256) ’
Reads the amplitude value
PRINT "Amplitude value : "; LEFT$(response$, IBCNT% - 1)
2.5.2 How to make repeated measurements
The measurement instructions allow you to make repeated measurements. The
CONFigure command allows you to configure the instrument, the READ? query
allows you to make a measurement, and the FETCh? query allows you to fetch
more signal characteristics.
PROGRAM EXAMPLE:
’
*****
’Measure and print 5x the AC-RMS, peak to peak, and
’amplitude of the signal on channel 1.
’
*****
response$ = SPACE$(30)
CALL Send (0, 8, "CONFigure:AC (@1)", 1) ’
FOR i = 1 TO 5 ’
CALL Send (0, 8, "READ:AC?", 1) ’
CALL Receive (0, 8, response$, 256) ’
PRINT "AC-RMS: "; LEFT$(response$, IBCNT%-1);
CALL Send (0, 8, "FETCh:PTPeak?", 1) ’
Fetches the Peak-To-Peak value
CALL Receive (0, 8, response$, 256) ’
PRINT " / Peak-To-Peak: "; LEFT$(response$, IBCNT%-1);
CALL Send (0, 8, "FETCh:AMPLitude?", 1) ’
Fetches the amplitude value
CALL Receive (0, 8, response$, 256) ’
Reads the amplitude value
PRINT " / Amplitude: "; LEFT$(response$, IBCNT%-1)
NEXT i