Using the National Instruments GPIB Interface

When CALLs are made to the GPIB driver, all parameters are passed as variables.

The module is identified as a device in two ways. First, the GPIB.COM driver is modified to include the module. Use the mainframe address as the primary bus address and the slot address as the secondary address. The driver requires secondary address 0 (which is for slot 0) to be entered as 96, secondary address 1 to be entered as 97, etc.

It is recommended that you disable auto serial poll in the GPIB.COM driver.

The module expects each command to be terminated by a line feed (character 10) and/or EOI. Configure the GPIB.COM driver to terminate all reads and writes with EOI.

The GPIB driver does all communication via strings. To send numeric data, number to-string conversion must be performed before the IBWRT( ). To read numeric data, string-to-number conversion must be performed after each IBRD( ).

Error handling is accomplished by checking the variable IBSTA%. If it is less than zero, an error has occurred. See the GPIB interface documentation for trapping and interpreting this error variable.

General Setup Information for Microsoft C

Using the Agilent 82335A/82990A/61062B GPIB Command Library

The address of a module is of type long and is determined the same as with Agilent BASIC. For example, the address 70501L means 7 is the select code of the GPIB interface, 05 is the GPIB address of the mainframe, 01 is the slot number (secondary address) of the module.

The module expects each command to be terminated by a line feed (character 10) and/or EOI. The default

configuration of the GPIB Command Library is carriage return+line feed for end-of-line termination and EOI at the end of a line. Therefore, the defaults are correct for use with the module.

The GPIB Command Library supports strings, numeric and array data formats. However, multiple data types cannot be sent in a single command. To send both string and numeric data in one command, convert all numeric data to strings, concatenate with the string data and send the combined string to the module. To read multiple data types, read the data into a string, and then manipulate the string by converting each piece into the appropriate data format.

Each command library call returns an int. If the value is zero, no error has occurred. Error handling is accomplished by checking the return value. See the command library documentation for interpretation of this error value.

Using the National Instruments GPIB Interface

The module is identified as a device in two ways. First, the GPIB.COM driver is modified to include the module. Use the mainframe address as the primary bus address. Use the slot address as the secondary address. The driver requires that secondary address 0 (which is for slot 0) be entered as 96, secondary address 1 be entered as 97, etc.

It is recommended that you disable the auto serial poll in the GPIB.COM driver.

The module expects each command to be terminated by either a line feed (character 10) and/or EOI. Configure the GPIB.COM driver to terminate all reads and writes with EOI.

The GPIB driver does all communication via strings. To send numeric data, number to-string conversion

must be performed before the ibwrt( ). To read numeric data, string-to-number conversion must be performed after each ibrd( ).

Error handling is accomplished by checking the variable IBSTA%. If bit 15 is set, an error has occurred. See the GPIB interface documentation for the interpretation of this error variable.

18 Introduction To Programming

Page 18
Image 18
Agilent Technologies 66lxxA manual Using the National Instruments Gpib Interface