Analytica Chimica Acta. 132 (1981) 205-208 Eisevier Scientific Publishing Company, Amsterdam -
Printed in The Netherlands
Short Communication
COMPUTER CONTROL OF THE PERKIN-ELMER INFRARED SPECTROPHOTOMETER
MODEL 580B
J. R_ CHIPPERFIELD* Department of Chemistry,
University of Hull, Hull HU6 7RX (Ct. Britain)
G. H. KIRBY Department of Computer Studies, University of Hull, Hull HU6 7RX (Gt. Britain) (Received 22 July 1981) Summary. Control is achieved via the spectrophotometer communications interface by a Digico Ml6V minicomputer. Programs for control and data handling have been developed in BASIC with assembly language subroutines to deai with communications between computer and spectrophotometer. The advantages of this system compared to a special data station are discussed The Perkin-Elmer model 580B infrared spectrophotometer (PE 580B) is fitted with a microprocessor, and can be controlled either manually or by an external controller. The usual controller is a Perkin-Elmer Infrared Data Station which contains a microprocessor, visual display unit, and a twin 7-in. floppy disc unit. With this data acquisition unit, the spectrophotometer can be completely controlled by programs, and spectra can be stored, replotted., compared, and processed. The programs supplied by the manufacturer are written in machine code, although there is a simple high-level language instruction set to enable the user to program certain functions; such software is sometimes unsuitable for research applications, and cannot easily be changed by the user. It seemed valuable to use a more powerful, general-purpose computer as controller, in order to achieve the following: (a) ability to write programs in a high-level language such as BASIC, PASCAL or FORTRAN; (b) hard-disc storage with much greater capacity than floppy discs; (c) addition of special graphics units and printers not available on the Perkin-Elmer Data Station; (d) faster processing resulting from more advanced computer architecture; (e) use of an available laboratory minicomputer rather than purchase of a specialpurpose data station; (f) transfer of results to a larger computer system. In this communication, connection of the spectrophotometer to a Digico M16V minicomputer is described and the problems associated with this are discussed.
Communicating
with the PE 580B
The PE 5808 can be fitted with a communications interface to permit external control as indicated in the manufacturer’s guide. This interface can 0003-2670/81/0000-60001$02.50
0 1981 BIsevier Scientific Publishing Company
206
be accessed by a serial link connected to a RS232C port on the accessory panel of the PE 580B. Data are received and transmitted by the interface as 8-bit ASCII characters with one start and one stop bit, a variety of baud rates from 300 to 9600 being available. The PE 580B iscontrolled via the communications interface by commands, each of which consists of a record starting with a $ character immediately followed by a 2-letter mnemonic code. Some commands require a single parameter, either numeric or a string, which is separated by one space from the code. Commands are terminated by either carriage return (CR) or line feed (LF). All records transmitted by the interface are preceded by one delete character (DEL) and are terminated by CR LF. The PE 580B responds to each record of input by a 4digit error code, which is all zeros if the record was acted upon successfully_ Further output depends on which command is being processed and may be terminated with a further error code. For each command the format of the next output record can always be predicted from the current one. Table 1 illustrates the sequence of communications following the sending of a status command, $ST. By default the interface operates in respond mode 1 whereby o&put records are queued until the interface receives a prompt character (ASCII DC& i.e. X-ON or control-and-Q) from the controller. The record at the head of the queue is then transmitted. This simple method allows the rate at which records are transmitted to be controlled by the user. The respond command is available to change to mode 0 for transmission as soon as information is available, should that be preferred_ Control of the PI3 580B by a Digico computer A Digico M16V minicomputer (Digico Ltd., Wedgewood Way, Stevenage,
England) has been used for a variety of laboratory computing applications with software written in Digico assembly language with a BASIC program to provide a simple user interface to the assembly language software [ 11. This present application illustrates different, simpler techniques for instrument control by a separate computer. The microprocessor-controlled PE 580B functions as an intelligent terminal when connected to the Digico TABLE I
Sequenceof data transfers between computerand PE 580B when the status of the iustrument is determined by means of a SST command Controlling computer
Data direction
SST CR LF X-ON
-
Spectrophotometer
DEL 0000 CR LF X-ON X-ON
Come&s
interface
DEL 580.02+3.0 DEL 0000 CR LF
CR LF
Request for status of instrument. Prompt to send a record_ Error code sent. Prompt to senda record. Status information record (62 chrs). Prompt to send a record. Error code to show end of operation.
207
computer via the communications interface, the PE 580B having the necessary intelligence to interpret and act upon data received and to transmit data back. An asynchronous line operated at 1200 baud connects the PE 580B to a general&d communication interface card (GCIC) in the Digico computer. The GCIC enables this computer to be interfaced to a variety of transmission equipment by using serial links terminating in V24/RS232 ports. Writing to and reading from terminals attached to the GCIC is accomplished by a Digico executive subroutine %MCD (available from the manufacturer) which must be called from an assembly language program. The program written here occupies less than 1K of 16-bit words and has subroutines to assign, connect, write to, read from, disconnect and release the PE 580B via the GCIC. A convenient user interface to this program is provided by a BASIC program which interacts with a user at a VDU adjacent to the PE 580B and remote from the computer. Digico BASIC has a character function, SLOT& which enables a subroutine written in assembly language to be executed by means of the call LET Af = SLOTE(B%J). The two parameters to SLOTS indicate the subroutine required, by means of an integer number IV, and any data for it, in the form of the character string Bdi. Any result to be returned from the subroutine is also in the form of a character string and is left in A& The BASIC program requests the user to indicate the tasks to be performed by the PE 580B in the form of the commands understood by its communications interface. The program adds the necessary terminator and passes the complete record to the appropriate assembly language subroutine using the SLOTS function_ Obviously, it would be possible for the user to input the tasks required in a fuller form: for example STATUS, in which case the BASIC program would have to translate this to the appropriate mnemonic code $ST and add the terminator. One immediate advantage of using a separate computer to control the PE 580B is that the prompt character necessary in the default respond mode can be sent automatically_ A prompt character is therefore appended to every command record sent to the PE 580B so that the user sees the error code displayed on his terminal as soon as it is sent back. If a further record is expected, e.g., a status record as in Table 1, the writing of another prompt character by the Digico computer occurs immediately after display of the error code. The principal advantage of computer control is the large capacity for storage of spectra offered by a file storage system based on hard discs, such as that available to BASIC users on minicomputers. It is computationally convenient to operate the PE 580B in its default respond mode when a wavenumber range is scanned. Every record of transmittance data has the format, expressed in Fortran conventions, 9(15,‘,‘), 15 with the final record having the value -9999 in its last field. A record of transmittance data is read by the Digico executive function into a buffer of 62 characters (including the DEL, CR and LF) and is inspected by code in the BASIC program to determine whether another similar record is expected or whether only the error code remains to be transmitted. Following storage of the fields of transmit-
20s
tance data, a prompt is sent to the PE 580B for transmission of the next record. No temporary stop in scanning, resulting from filling of the PE 580B communications interface buffer, has been noticed. Loss of data during communications has not been experienced. The PE 580B communications interface does not receive and transmit data at the same time, and the Digico executive function controlling the GCIC is used in half-duplex standby mode with a request to read being issued immediately after a write and before testing for completion of the write, as described in the Executive Manual. It was found more acceptable to test each character received for a LF, rather than to use a count of characters to determine the end of a record read by the Digico executive function, because this copes with situations where an unexpected number of characters is received. An additional precaution found to be useful, particularly during software development and testing, is a time-out on reading. The Digico executive function allows specification of the maximum permitted elapsed time before receipt of the next character. If no data transmission occurs from the PE 580B interface within this time (e.g., because of a hardware failure) then execution ultimately reverts to the BASIC program and an appropriate reply is communicated to the user. The transmittance data need no processing before being stored in a random access file during or after data acquisition. It is available afterwards for processing and/or display in any way desired by the user. In order to make use of the facility on the PE 580B for replotting a stored spectrum on the recorder of the instrument by means of the $PB command, the interface requires the packing of each transmittance into a 1%bit signed integer by transmission as a character pair. A separate BASIC program has been written to do this. Conclusion
The control of the PE 580B by a separate computer allows the user to write programs for data acquisition and for subsequent handling of the spectra in a high-level programming language_ Whilst assembly language subroutines may be necessary in order to achieve the speed desirable to avoid loss of characters in communication, these can be called from high-level language programs on most computing systems. Much of the programming can therefore be done by the user rather than an experienced programmer. Any high-level language which can handle input and output of character strings on a specified channel could be used. The use of character strings by Digico for communication between BASIC and assembly language sub routines, whilst not always convenient in laboratory computing [l] , makes the programming for this application relatively straightforward. The authors are grateful to Mr. G. Collier for his assistance with the spectrophotometer and to Mr. P. F. Martin for his contribution to the programming. REFERENCE 1 G. H. Kirby,
J. II. Chipperfield
and D. E. Webster,
Comput.
Chem.,
3 (1979)
135.