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:

  1. The Listener is addressed to talk and the Serial Poll Enable (SPE) command byte is sent.
  2. The ATN line is set high and the Listener returns the status byte.
  3. The ATN line is set low and the Serial Poll Disable (SPD) command byte is sent to end the poll sequence.

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.

  1. Create instrument objects -- Create a GPIB object associated with a Agilent 33120A function generator at primary address 1.
  1. Create a GPIB object associated with a Tektronix TDS 210 oscilloscope at primary address 2.

  1. Connect to the instrument -- Connect g1 to the function generator and connect g2 to the oscilloscope.
  2. Configure property values -- Configure both objects to time out after 1 second.
  3. Write and read data -- Configure the function generator to request service when a command error occurs.
  1. Configure the oscilloscope to request service when a command error occurs.

    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.

  1. Disconnect and clean up -- When you no longer need 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