Controlling Instruments Over HP-IB

This section tells how to use the OSA as a controller on HP-IB. As a controller, the OSA transfers data to or accepts data from other HP-IB devices, thus expanding its measurement capability. For example, the OSA can control an HP-IB switch driver to select the correct optical input for measurement. Or, the OSA can control a power meter and signal source.

Use the OUTPUT command to send data to an HP-IB device located at a particular HP-IB address. Below, the OSA sends the message \SWITCH ON" to a device at HP-IB address 19.

10 OUTPUT 723;"OUTPUT 19,KL,$SWITCH ON;$;"

Data is sent as free-￿eld ASCII numbers in three di￿erent output formats, called, K, KC, and KL. The K format sends data without a terminator. The KC format terminates the data with a carriage- return/line-feed. The KL format terminates data with a line-feed and EOI (end-or-identify). Use the format that is compatible with the HP-IB device receiving the data. Data may also be sent as non-ASCII numbers using the F format, which speci￿es the number of characters (￿eld width) and decimal places.

Use the ENTER command to receive data from an HP-IB device. Below, ENTER receives a value sent by the device at HP-IB address 19 and stores the value in a user-de￿ned variable in the OSA.

10

OUTPUT

723;"OUTPUT 19,KL,$CENTERWL?;$;"

Request center wavelength value.

20

OUTPUT

723;"ENTER 19,K,NN;"

Receive center wavelength value.

Three input formats for data are available: K for free-￿eld ASCII numbers, B for bytes (8 bits), and W for words (2 bytes). Be sure to use an input format that is compatible with the output format of the HP-IB device. In the example below, the OSA sets the power of a source to the value of a variable. The message must be sent with several output statements, since one part of the message is a string of characters and another part is a OSA variable. Notice that a character string must be delimited.

10

OUTPUT 723;"OUTPUT 19,K,$PW $;"

Send letters \PW " to the source .

20

OUTPUT

723;"OUTPUT

19,K,POWER_W;"

Send current value of variable .

30

OUTPUT

723;"OUTPUT

19,KL,$WATTS;$;"

Send letters \WATTS" to the source .

Before the ENTER and OUTPUT functions are executed, the computer must be disconnected from HP-IB. The OSA can control the HP-IB only if a

6-19