Section 5 Listner Input Formats
5-18
■ <QUERY PROGRAM HEADER>
<QUERY PROGRAM HEADER> is a query command which is sent from a con-
troller to a device in advance so that the controller can receive response messages
from the device. This header always ends with a query indicator “?”. It is ex-
plained below using examples of programs.
The format of <QUERY PROGRAM HEADER> is the same as that of
<COMMAND PROGRAM HEADER> with the exception that a query indicator
“?” is added at the end. See Section 5.2.8.
● <Example 1> Setting and reading a center wavelength
10 WRITE @108:"CNT 1000"
20 WRITE @108:"CNT?"! ....................... Query message CNT?
30 READ @108:A
40 PRINT A;"nm"
Line 10: A command header CNT for setting a center wavelength and a program message
consisting of program data 1. 1000 nm is set for the device.
Line 20: A program message that requires the device to send the set 1000 nm to the con-
troller. A query header “CNT?” is used.
Line 30: The listener device MS9710C that received the query header “CNT?” from the
controller becomes a talker. The device is a controller that has become a listener,
and it sends a response message 1000 in response to CNT?. The listener reads the
response message into the numeric variable A.
Line 40: The wavelength “1000 nm” is displayed on the CRT. However, if HEAD ON is
specified with a HEAD command, “CNT 1000” is sent.
● <Example 2> Reading measurement data on 501 measuring points from memory A and printing the measurement data
100 WRITE @108:"DMA?"
110 FOR K=0 TO 500
120 READ @108:DT(K)
130 PRINT DT(K);"dBm"
140 NEXT
150 END
Line 100: A query message “DMA?” is sent to the listener to store 501 pieces of data, start-
ing at address 0.
Line 120: Line 100 causes the device to reply, response messages at points 0 to 500 are sent
to the controller, and they are read into a numeric array variable DT (K).