Instrument Control Toolbox    
fopen

Connect an instrument object to the instrument

Syntax

Arguments

obj
An instrument object or an array of instrument objects.

Description

fopen(obj) connects obj to the instrument.

Remarks

Before you can perform a read or write operation, obj must be connected to the instrument with the fopen function. When obj is connected to the instrument

An error is returned if you attempt to perform a read or write operation while obj is not connected to the instrument. You can connect only one instrument object to the same instrument. For example, you can connect only one serial port object to an instrument associated with the COM1 port. Similarly, you can connect only one GPIB object to an instrument with a given board index, primary address, and secondary address.

Some properties are read-only while the instrument object is open (connected), and must be configured before using fopen. Examples include InputBufferSize and OutputBufferSize. Refer to the property reference pages or use the propinfo function to determine which properties have this constraint.

The values for some properties are verified only after obj is connected to the instrument. If any of these properties are incorrectly configured, then an error is returned when fopen is issued and obj is not connected to the instrument. Properties of this type include BaudRate and SecondaryAddress, and are associated with instrument settings.

Example

This example creates the GPIB object g, connects g to the instrument using fopen, writes and reads text data, and then disconnects g from the instrument.

See Also

Functions

fclose, instrhelp, propinfo

Properties

BytesAvailable, BytesToOutput, Status, ValuesReceived, ValuesSent


  flushoutput fprintf