Instrument Control Toolbox    

Communicating with a Serial Port Instrument

This example illustrates how to communicate with an instrument via the serial port. The instrument is a Tektronix TDS 210 two-channel digital oscilloscope connected to the COM1 port of a PC, and configured for a baud rate of 4800 and a carriage return (CR) terminator.

You should modify this example to suit your specific instrument control application needs. If you want detailed information about communicating with an instrument connected to the serial port, refer to Controlling Serial Port Instruments.

  1. Create an instrument object -- Create the serial port object s associated with the COM1 serial port.
  2. Configure property values -- Configure s to match the instrument's baud rate and terminator.
  3. Connect to the instrument -- Connect s to the instrument. This step occurs after property values are configured because serial port instruments can transfer data immediately after the connection is established.
  4. Write and read data -- Write the *IDN? command to the instrument and then read back the result of the command. *IDN? queries the instrument for identification information.
  5. Disconnect and clean up -- When you no longer need s, you should disconnect it from the instrument, remove it from memory, and remove it from the MATLAB workspace.

  Communicating with a GPIB-VXI Instrument Understanding the Toolbox Capabilities