Instrument Control Toolbox | ![]() ![]() |
Serial Polls
You can execute a serial poll with the spoll
function. In a serial poll, the Controller asks (polls) each addressed Listener to send back a status byte that indicates whether it has asserted the SRQ line and needs servicing. The seventh bit of this byte (the RQS bit) is set if the instrument is requesting service.
The Controller performs the following steps for every addressed Listener:
Refer to Status and Event Reporting for more information on the GPIB bus lines and the RQS bit.
Example: Executing a Serial Poll
This example shows you how to execute a serial poll for a Agilent 33120A function generator, and a Tektronix TDS 210 oscilloscope. In doing so, the example shows you how to configure many of the status bits described in The Standard Event Status Register.
g1
to the function generator and connect g2
to the oscilloscope.
fprintf(g2,'*CLS') fprintf(g2,'*PSC 0') fprintf(g2,'*ESE 32') fprintf(g2,'DESE 32') fprintf(g2,'*SRE 32')
Determine if any instrument needs servicing.
Query the voltage value for each instrument.
Determine if either instrument produced an error due to the preceding query.
Because Volt?
is an invalid command for the oscilloscope, it is requesting service.
Because Volt?
is a valid command for the function generator, the value is read back successfully.
However, the oscilloscope read operation times out after 1 second.
g1
and g2
, you should disconnect them from the instruments, and remove them from memory and from the MATLAB workspace.
![]() | Triggers | Controlling Instruments Using the VISA Standard | ![]() |