Versatile IEEE-488 data acquisition and control routines for a diode array spectrophotometer

The UV-visible diode array spectrophotometer is a work-horse instrument for many laboratories. This article provides simple data acquisition and control routines in Microsoft QuickBasic for a HP-8452A diode array spectrophotometer interfaced to an IBM PC/XT/AT, or compatible, microcomputer. These allow capture of full spectra and measure absorbance at one or several wavelengths at preset time intervals. The variance in absorbance at each wavelength is available as an option.


Introduction
The diode array spectrophotometer has become an integral part of quantitative and kinetic UV-visible absorbance studies in this laboratory [1,2] and in many others. While operating software purchased from an instrument rnanufacturer is well suited to most routine analytical needs, it is not flexible enough for some research purposes. Indeed, the nature of research is such that one cannot reasonably expect instrument companies to be able to foresee all needs in advance. Therefore, there is a need for the researcher to be able to write specialized instrument control and data acquisition routines to meet specific research purposes. An example is integration of spectrometer into a larger automated analytical instrument [3].
The manufacturer of the diode array spectrophotometer used here (a Hewlett-Packard Model 8452A) provides, as an option, a library ofcommand routines ,which programmers can incorporate into their own code. Languages supported include Hewlett-Packard (HP) series 200 PASCAL and BASIC, IBM BASICA and Microsoft QuickBasic. The task of programming versatile or specialist control and data acquisition routines, however, is still not straightforward. In this short article, the HP-8452A hardware is discussed and some general routines written at a higher level in Microsoft QuickBasic+ + are presented. These initialize the spectrophotometer, execute control tlanctions, and acquire data. These routines have been integrated into stopped flow kinetics programs and general methods development Author to whom correspondence should be addressed. " The authors would appreciate hearing from scientists who find this article useful. + + These routines are placed in the public domain, and may be used freely, but may not themselves be sold for profit nor included in a larger work to be sold for profit without written authorization from the authors of this paper. software for flow injection analysis. The routines may readily be adapted for other uses of the spectrophotometer and the defaults changed. They could also be adapted for use with other HP-IB compatible devices, such as meters and transient digitizers.
The HP 8452A diode array is a single-beam microprocessor-controlled UV-visible spectrophotometer, which provides 316 diodes across the wavelength range 190-820 nm at 2 nm resolution. It can be controlled by an IBM PC/XT/AT or compatible computer using HP's routines. The spectrophotometer has two communications interfaces: a parallel Hewlett-Packard Interface Bus (HP-IB) and a serial HP-IL interface. Most commonly used is the HP-IB: this IEEE-488 type, high-speed, general purpose, digital interface provides a simple means to control and acquire data from up to 15 instruments or devices, and requires a single adapter card in the control computer. Clearly defined functions exist for each of the 24 IEEE-488 lines: eight are lines for data transmission; another eight for handshaking, and the rest for grounding and shielding. Total transmission pathlengths over the interconnecting cables cannot exceed 20 m without additional buffering and the length of cable per device is limited to 2 m. This design provides a maximum data transfer rate of Mbyte/s, with minimal System cost and complexity.
This article assumes that instrument-computer communications will be across an HP-IB interface, using the routines found in the HP-IB Command Library.
The diode array spectrophotometer has become an analytical workhorse in this laboratory. Applications fall into the following categories: Scanning: In the general scan mode, the spectrophotometer can acquire and display the absorption spectrum (absorbance versus wavelength) of a sample over the entire wavelength range, over any userspecified portion ofthis range, or at up to six individual wavelengths. repeatedly for up to six individual wavelengths in as little as 0"1 s intervals. Alternatively, a wavelength range may be specified by the user. Data can be displayed in either graphical or tabular form, in real time. Use of different temperatures via a thermostated cell allows calculation of activation energies.
Default initial measurement parameters are set as follows: (1) Use the wavelength range 190-820 m.
Hardware and software requirements (1) HP 8452A Diode Array Spectrophotometer and HP 82990A HP-IB Interface and Command Library for MS-DOS.
(2) IBM PC/XT/AT/386 compatible microcomputer with HP-IB interface card. Initialization of the diode array spectrophotometer is achieved by the user-defined subroutine HPINIT. Parameters for absorbance measurements such as integration time and sampling intervals are defined through the PARINIT subroutine. The user may choose to monitor single, multiple, or a range of diodes. Options to have the shutter closed or open between repeated measurement cycles and/or to calculate the variance of absorbance values are provided, but are constrained by integration and sampling time intervals. Since shutter processing takes ca. 0'5 s, the sampling interval (time between repeat measurements) must be greater than the integration time + 0'5 s, or a run time error will result.
When variance data are required, the time taken by the instrument to calculate these must also be considered.
Using these routines, a sampling interval of as little as 0'6 s is possible for a full spectrum without variance data, and 1.8 s is needed per full spectrum if variance data is taken at every diode. The length (in bytes) of each record transferred across the HP-IB is dependent on whether variance information is calculated, and is given by: # of diodes * (data point size + variance data size) + header size + endline bytes (3) Turn lamp on.
(5) Set the trigger to be inactive.
(8) Use 0"5 s reference integration time with no data output.
The HPINIT subprogram initializes the HP-IB interface and the HP 8452A spectrophotometer by first clearing the device and the HPIB board, and then ascertaining that the 'device identity' specified is correct. It allows the user to enter alternative measurement parameters and contains routines that inform the user of detected error types and wait for appropriate adjustment to be made before continuing.
HPSEND sends the command string required to select a wavelength, sampling interval, data type (absorbance, transmittance), data format (here as BINARY). It may also request the status of the device (for example ready for measure). The command is passed via the HP-IB driver subroutine, IOOUTPUTS. Should an error be detected, a message is printed but execution continues. After the times and wavelengths are set via the HPSEND subroutine, the status of the device is checked for 'ready to measure'. If the spectrophotometer is not ready a reference spectrum is obtained and the status is rechecked. If, after this, it is still not ready, a fatal error results and program aborts.
DETSTRT initiates multiple or single wavelength data acquisition with a 0'1 s integration time and a 0"2 s sampling interval (or 0"6 s sampling frequency for a minimum of 36 diodes) of the spectrophotometer. Absorbance (and optionally variance) data are returned in binary format. It assumes the analytical wavelength(s) and the status (i.e. not initialized, initialized, or initialized and reference taken) of the detector are SHARED COMMON variables.
DETSTOP stops a current measurement cycle and clears the input, output, and error buffers (via the HP-IB driver subroutine IOCLEAR). HPGET returns a data string from the HP diode array through the HP-IB interface via the IOENTERS driver subroutine. If it encounters an error while reading string from device, it prints an error message and re-tries the instruction. If an error is again detected, the routine aborts. GETAVG obtains the data points from the diode array spectrometer via the IOENTERS subroutine. It calls IOENTERS until the length of data string received equals the maximum spaces set (i.e. six bytes for the header, plus three bytes per diode for absorbance/transmittance measurements, and optionally two additional bytes per diode for variance data).
The subroutines HPINIT and DETSTRT must be called first, in that order, before GETAVG can operate. Data points are saved as an array or as single values, for multiple or single diode measurements respectively. WTKEY waits for a key to be pressed. PAUSE waits for a specified delay time before program execution continues. FLSAVE saves the data collected by GETAVG to disk. For multiple wavelength data, the number of diodes and minimum and maximum wavelengths are stored in the file header. These are then followed with an array of data points for every diode, in ascending numerical wavelength order. For single wavelength data, the wavelength used followed by its corresponding data point is stored for every cycle. 'Detector scale factor for the HP 'Assume single wavelength detection 'Nov print banners and instructions for user. LOCATE 3, 30 PRINT "HPCONTRL version 1" LOCATE 5, 10 PRINT "HP DATA ACQUISITION FOR SINGLE and NULTIPLE WAVELENGTH PROGRAI<" II LOCATE 8, 18 PRINT Laboratory for Automated Chemical Analysis" LOCATE 9, 9 PRINT "Chemistry Department, University of British Columbia, Canada." LOCATE 11, 10 PRINT "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" LOCATE 13,1 PRINT " This program attos you to acquire data from the PRINT " spectrophotometer for both single and multiple wavelengths."

PRINT "
The uavetength range available is 190 820 nm. Up to 30 diodes" PRINT " can be monitored uith a sampling interval of at least 0.2 sec."

PRINT "
For more than 30 diodes the minimum sampling interval is 0.6 sec.   'This subroutine returns a string from the spectrophotometer through the 'HPIB interface using the !OENTERS driver subroutine. RESP$ is the string 'returned, adjusted for its actual length. If an error is detected, it is 'reported, but execution continues. The variables ISC& (select code) and 'HPADD& (diode array device address) are assumed to be in shared common. SUB HPINIT (NLIST, WAVE()) 'Subroutine to initialize the diode array spectrophotometer. It is 'responsible for the initialization sequence of the Heelett-Packard 'diode array spectrophotometer. %t checks the identity of the device, 'its calibration setting, lamp status, and other factors. It also 'obtains from the user the analytical uavelength. If the initialization 'sequence is not successful, the user is given the chance to make 'adjustments before the sequence is retried. 'The following variables in shared common are used: 'Get the analytical wavelength CLS