Instrument Control Toolbox    

Communicating with a GPIB Instrument

This example illustrates how to communicate with a GPIB instrument. The GPIB controller is a National Instruments AT-GPIB card. The instrument is an Agilent 33120A Function Generator, which is outputting a 2 volt peak-to-peak signal.

You should modify this example to suit your specific instrument control application needs. If you want detailed information about communicating with an instrument via GPIB, refer to Controlling GPIB Instruments.

  1. Create an instrument object -- Create the GPIB object g associated with a National Instruments GPIB board with board index 0, and an instrument with primary address 1.
  2. Connect to the instrument -- Connect g to the instrument.
  3. Configure property values -- Configure g to assert the EOI line when the line feed character is written to the instrument, and to complete read operations when the line feed character is read from the instrument.
  4. Write and read data -- Change the instrument's peak-to-peak voltage to 6 volts by writing the Volt 3 command, query the peak-to-peak voltage value, and then read the voltage value.
  5. Disconnect and clean up -- When you no longer need g, you should disconnect it from the instrument, remove it from memory, and remove it from the MATLAB workspace.

  Communicating with Your Instrument Communicating with a GPIB-VXI Instrument