The PC Connection - Analytical Chemistry (ACS Publications)

May 29, 2012 - Anal. Chem. , 1986, 58 (6), pp 678A–689A. DOI: 10.1021/ac00297a772. Publication Date: May 1986. ACS Legacy Archive. Cite this:Anal...
0 downloads 0 Views 10MB Size
A/C Interface Edited by Raymond E. Dessy

The PC Connection Part 1 The minicomputer revolution of the 1970s enlisted many scientists into its real-time brigades, where they were forced to become proficient in the use of the primitive weapons of that era. The new personal computer (PC) revolution has gathered more followers, provided them with inexpensive, offthe-shelf weapons, and then often left them on the battlefield with insufficient training and logistics support. This series of articles is dedicated to those new revolutionaries who have discovered that there is more involved in interfacing instruments with computers than a wire and a plug. The serial digital connection Most third-generation instruments with embedded computers give the user a digital output that is computer compatible. The plug provided by the instrument vendor usually conforms to a standard that is as uniform and consistent as the fittings for gas cylinders or plumbing connections. It usually guarantees that smoke will not roll when you interconnect to your PC, but there is no assurance that data will flow.

RS-232C and V.24. The most common standard adheres to recommendations made by the EIA (Electronics Industry Association) and CCITT (Consultive Committee in International Telegraphy and Telephony). EIA standards are labeled RS-x (recommended standard x), while the CCITT standards carry V.x or X.x labels. RS-232C and V.24 are equivalent standard protocols prescribing how to connect information-processing equipment with communications lines. Although originally oriented to terminals and their associated modem communication equipment, and conceived in a more classic period, RS-232C and V.24 are the most prevalent digital connection between instruments and PCs today. Physical protocol. Most prospective users are already familiar with the ubiquitous D-shaped plug that appears on PCs, computer terminals, and instruments. This plug encloses 25 pins in its housing. Their use and the plug itself are not standardized by EIA or CCITT, and even the common pin assignments, shown in Figure 1, are reinterpreted by many instrument

678 A • ANALYTICAL CHEMISTRY, VOL. 58, NO. 6, MAY 1986

manufacturers and vendors. Electrical protocol. The electrical conventions used with RS-232C, and the other logic families used in digital interfacing, are described in the sidebar on the facing page. Figure 1 shows a typical RS-232C interconnect. Traditionally one end is called the data terminal, the other the data set (referring to a modem). Pins 2 and 3 of the plug accommodate individual wires for the transmit and receive functions, allowing full two-way communication (full-duplex operation). Obviously, in each communication path, one end is a talker, the other end the listener. Pin 7 of the plug serves as a signal ground. Logical protocol. Data and control information are sent along the two data channels in code. The most common code is the American Standard Code for Information Interchange (ASCII). This is a 7- or 8-bit code consisting of l's and O's that represent letters, numbers, and control characters. The 7-bit code is shown in Table I. Fundamentally, 7 bits can encode 128 possible values. The 26 upper-case and 26 lower-case letters, 10 Arabic 0003-2700/86/0358-678A$01.50/0 © 1986 American Chemical Society

A logic family primer • T T L . T h e most c o m m o n digital logic family. Transistor-transistor-coupled logic defines a logic 0 as a voltage between approximately 0 and 1 V and a logic 1 as a voltage between 2 and 3.5 V. T T L signals can only " s o u r c e " a few mA as a logic 1, and they " s i n k " 1 0 - 2 0 m A a t a logic 0. • Open collector. Because the outputs of T T L gates cannot be collected together, a special logic device allows several identical gates to control the potential of a wire. Because o n e or the other of these gates can affect the wire, this configuration is called a wired-OR. In these devices the output of a T T L gate is used to control a transistor that is biased completely on or completely off. In the latter condition the collector of t h e transistor looks like an open circuit. T h e open collector (OC) serves as a switch that connects a wire to ground. Although t h e O C has two states, it does not (by itself) supply a voltage. T h e actual voltage level comes from a " p u l l - u p " resistor in series with the power supply. • Tristate. This is another technology that can also achieve the wired-OR action. This gate has a control line that activates a n d deactivates the output. W h e n this line is a logic 1 the output may assume a logic 1 or 0 state. W h e n the control line is a logic 0 the output appears to be a high i m p e d a n c e — a total of three states.

digits, and a variety of grammatical symbols (,:;'"|[) can be expressed. The remaining combinations have application as control characters, and their names show their age—WRU (who are you), BEL (bell tone), ESC (escape). Computer keyboards generate most of these codes by using combinations of the regular alphanumeric keys and two special keys called CTL and A L T . When the data terminal end or the data set end wishes to send a character, the 7-bit code representing it is placed serially on the appropriate wire. Asynchronous protocol. To coordinate exchange, the data bit string is encapsulated between START and STOP bits. The RS-232C data interchange lines are normally a logic 1 (-10 V). The S T A R T bit drops the line to a logic 0 momentarily ( + 10 V), telling the listener that a data string is coming. This is the only synchronizing element in the communication link. After this START bit, the listener samples the incoming data stream at a rate determined by its own internal clock, independent of the talker's clock. The communication is essential-



Negative logic. Where the normal 1 = true = ON and 0 = false = O F F condition is reversed.



RS-232. Commonly - 5 to - 1 5 V represents a logic 1 (mark); + 5 to + 1 5 V a logic 0 (space). A positive voltage implies an ON condition for interface control; a negative voltage an OFF condition (cf., negative logic).

• Current loop. 20 or 60 mA of current represents a logic 1 ; no current a logic 0. • Frequency shift keying. FSK techniques use two different frequencies to represent logic levels for transmission along standard telephone lines. This is a binary frequency modulation transmission. • Quadrature amplitude modulation (QAM). Most telephone connections can support frequencies of only a few thousand hertz, and high-speed modems must allocate narrow bandwidths to the separate transmit and receive functions. How do you send data at 2400 bits/s in a pass-band of 600 Hz? Often two or four bits of information are conveyed for each hertz of bandwidth by representing the data in a phaseencoded manner called QAM.

ANALYTICAL CHEMISTRY, VOL. 58, NO. 6, MAY 1986 • 679 A

1 I l e lWO

most notable high speed events of the year.

+ 10V

JUUUUTL·: Receive (RCV)

1. Halley's comet. 2. Protein separations in seconds.

Request to send (RTS) • Clear to send (CTS) — Data set ready (DSR) Common — • Data carrier detect (DCD) •

Data terminal ready (DTR).

Figure 1. The RS-232C convention has a 25-pin plug Eight of the most commonly used signals are shown. Data are transmitted along the lines connecting pins 2 and 3, termed TRANSMIT (XMT) and RECEIVE (RCV). The bit string being sent is an ASCII " U " (10101012)

with even parity. The other lines are used for hardware handshakes. Negative logic is used Very rapid separation of the components in ascites fluid from MOPC21.

Bio-Rad's new Mlcroanalyzer™ cartridges perform ion exchange chromatography of protein samples with unprecedented speed. Their short format and an entirely new proprietary rigid polymeric packing allow flow rates as high as 5 ml/min and short elution times. This assures the high throughput needed for QC and biomedical applications. These non-porous beads separate proteins of any molecular weight. Furthermore, the high recovery achieved with this packing makes these cartridges uniquely suited for micropreparative uses. Recoveries are normally greater than 95% with μg samples. Three MA7 cartridges are exclusive­ ly available from Bio-Rad, including one for peptide analysis. Optimal performance is achieved by using these cartridges with our Protein Microanalyzer System. For full details, contact:

ly asynchronous. After all data bits are received, STOP bit(s) give the listener a chance to pause before the next string. Some systems hold the trans­ mission line at a logic 1 for one bit pe­ riod, some for two periods (one or two STOP bits). Parity and error checking. One thing the listener might do during this waiting period is ascertain whether

Table 1. ASCII 7-bit code Character

Binary code

Character

Binary code

A Β C

1000001 1000010 1000011

a b c

1100001 1100010 1100011

Ζ

1011010

ζ

1111010

0 1 2

0110000 0110001 0110010

CR LF

0001101 0001010 0101100

9

0111001

NULL

CTL-Z CTL-C

BIO-RAD

CTL-Z= SUB

1414 Harbour Way South Richmond, CA 94804 (415) 232-7000 800-4-BIO-RAD

the character received is valid. For ex­ ample, the talker may choose to send an eighth bit along with the data bits. This bit is chosen to be a logic 1 or zero, so as to make the number of 1bits in the transmission odd or even (Table II). This is called the parity bit. The lis­ tener can scan the incoming 7 bits of data and calculate its own parity val-

0011010 = EOF 0000011 =ETX

>

0000000

CTL-Q

0010001 = XOFF

CTL-S

0010011 = XON

CTL-Q = DC 1 , CTL-S = DC3

The ASCII code uses 7 bits to encode alphanumeric characters. Some of the 128 possible c o m b i ­ nations are used for control characters; they are generated at the keyboard by depressing the CTL (and/or ALT) key in combination with another key. C T L - Q / C T L - S ( D C 1 / D C 3 or X O N / X O F F ) is often used to stop and start transmission between devices in a software handshake, CTL-Z ( S U B or EOF) is commonly used as an end-of-file mark; CTL-C (ETX) usually forces control back to the operating system

Answers. CIRCLE 27 ON READER SERVICE CARD 680 A • ANALYTICAL CHEMISTRY, VOL. 58, NO. 6, MAY 1986

Table II. Parity ASCII 7-bK binary

Character A C 1 3

1000001 1000011 0110001 0110011

3 6 9

With odd parity

With even parity

10000011 10000110 01100010 01100111

10000010 10000111 01100011 01100110

Check sum Odd parity

Even parity

01100111 01101101 01110011 01000111

01100110 01101100 01110010 01000100

The eighth (or ninth) bit of serial asynchronous transmission is often used as a parity bit. Odd or even parity is invoked by writing a logic 1 or 0 in this bit so as to force the number of 1-bits to be odd or even. The receiving end can use the observed and calculated parity to determine if a transmission error has occurred. The sum of transmitted values (check sum) is also used to detect errors

ues. If the two parity values agree the associated character probably has been received correctly. If the two values disagree then a logic 1 or 0 has been garbled in transmission. In telecommunications this disagreement usually leads the listener to request a retransmission of the character. Most instruments are "babblers," and there is no mechanism to make such a request. The listener can only mark the data word involved. Scientists in noisy environments should note that multiple even numbers of transmission errors cannot be detected by parity checks. Unfortunately errors on transmission lines usually occur in bursts,

Signal name

Pin#

Data terminal ready

— « 20 — J

Data set ready

ii

6

rather than as discrete, well-separated events. Two other methods can be used to detect errors in serial communication lines. In the simplest approach the talker keeps a running sum of the ASCII values it sends and appends the least significant bytes of the sum to the transmission. The listener calculates its own check sum and subtracts the two values. If the result is zero the transmission is likely to be correct. This approach also cannot detect multiple errors (have you ever made two compensating errors in your travel spread sheet?). A few systems use a cyclic redun-

Level

1

Request to send

Clear to send

Data

1

L1 L JITUIJUI

Figure 2. The RS-232C protocol may use a hardware handshake to coordinate information exchange The relative timing of the handshake signals is shown 682 A • ANALYTICAL CHEMISTRY, VOL. 58, NO. 6, MAY 1986

dancy check (CRC) algorithm, similar to the one used to check the validity of transfers to and from disks. The 16-bit CRC word sent with a set of data can be used to detect burst errors of 16 bits or less and a high percentage of longer error bursts. The approach is computationally intensive and will limit transmission speeds if the CRC is calculated in real time by software. Hardware CRC chips are available. Baud rate. The listener must expect bits to arrive at the same rate that the talker places them on the line. This is expressed in bits per second, often referred to (sometimes incorrectly) as the baud rate. Common values are 150, 300, 600, 1200, 2400, 4800, 9600, and 19,200 baud. At 9600 baud it takes about 1 ms for a character to transit the wire. Communication lines differ in their ability to transmit faithfully the high frequencies involved in the square wave functions associated with digital transmission. At higher baud rates dedicated copper wires begin to distort the signals because of capacitive effects. Directly connected RS-232C protocols will usually support communication at 2400 baud for a kilometer, although vendors will only guarantee 300 baud for about 10 m. For longer distances, modems can be used. These use frequency shift keying (FSK) to encode data at speeds up to 1200 baud. At 1200 bits/s and above, quadrature amplitude modulation (see sidebar) is often used. Modems operating at 9600 bits/s are available. Some of these use proprietary techniques and can communicate only with other modems made by the same vendor. Handshake hardware. When humans communicate, a set of real or subliminal "handshakes" occurs to coordinate the interchange. With RS232C these take the form of electrical signals. The conventions are shown in Figure 2. Pins 20 (data terminal ready) and 6 (data set ready) are used to communicate that the units physically exist, power has been applied, and they are operational. Pin 4 (request to send) is used to demand the attention of the listener, while pin 5 (clear to send) acknowledges this request. Other connections coordinate activities involving a telephone circuit, for example, pin 8 (carrier detect) and pin 22 (ring indicator). Software handshake. Hardware handshake lines may be augmented or replaced by software handshakes. These involve the exchange of control characters along the pin 2 and pin 3 data lines. The most common characters used for this purpose are called X O N / X O F F or DC3/DC1 (see Table I).

One end of the connection tells the other to turn off transmission momen-

Figure 3. The RS-232C standard is not always fully innplemented or is occasionally violated Patch wires are often necessary to correct these deficiencies

tarily (XOFF). This usually signifies that the listener has some communica­ tion chores to perform, such as a need to empty buffers, write to disk, or ser­ vice another task. The sending of XON indicates that the listener has resolved the problem. Why doesn't it work?

Very often your first attempt at us­ ing the RS-232C PC interconnection fails. Why? Problem 1: The plugs do not match. RS-232C connectors come with 25 male pins that fit into female sockets. The pins and sockets are enshrouded in male or female plugs or receptacles. All four possible combinations occur. Even DEC and IBM equipment are often nonstandard. Solution: Stock spare shroud enclo­ sures or purchase gender change adapters. Problem 2: No data are seen after the interconnect. In most cases this is because the instrument vendor and your PC disagree as to who is the lis­ tener and talker. You have two talkers interconnected and two listeners in­ terconnected at pins 2 and 3. Solution: Reverse the connections at pins 2 and 3 at one end or purchase a null modem, which does the same thing (Figure 3). If this fails, a hand­ shake problem may exist. Problem 3: The data coming in are garbage. If the baud rates differ at each end, it is common to get a "mon­ key at the typewriter" condition. Solution: All serial ports on PCs should have a programmable baud

rate register (a software command changes the rate) or a hardware selec­ tion option (installation or removal of jumper wires changes the rate). Problem 4: The system hangs after one character or does not work at all. In many cases vendors have chosen not to install the whole set of hard­ ware handshake lines (Figure 2). Solution: Install jumper wires (Fig­ ure 3) to make the deficient end think the required handshake line is assert-

ed. Many serial ports in PCs have jumper pads already installed to per­ form this task. If they are not present jumpers may be installed in the RS232C shroud between pins. Trouble­ shooting devices called breakout boxes are available to diagnose problems such as this; they may also be used to add jumper wires easily. Smart cables handle the problem almost automati­ cally; they have light-emitting diodes that tell you what switches to close and open. Problem 5: My PC data acquisition program never stops. Most PC pro­ grams expect incoming ASCII data sets to have an end-of-file (EOF) char­ acter that signals the end of the data stream. This is commonly the CTL-Z character. Your instrument may not be sending an EOF or may be sending the wrong one. Solution: Change the expected EOF character at the PC end (usually easy) or the transmitted EOF at the instru­ ment (usually difficult). If your PC software package does not give a setup option to change the EOF, consider us­ ing one of the utility programs avail­ able (e.g., Norton Utilities) to explore the program on disk for the EOF char­ acter and change it. This may require professional help. Problem 6: My PC reports that all the incoming data have errors; or the data look like this— ll!#a —and then they hang! The incoming data are not restricted to 7-bit ASCII. In­ struments variously transmit 7 bits plus parity or 8 bits plus parity. The eighth bit opens up another 128 possi­ ble characters often used for graphics or foreign language character sets.

Table III. Numbering conventions Decimal

Binary

1 2 3 4 5 6 7

8 9 10 11 12 13 14 15

1 1 1 1 1 1 1 1

001 010 011 100 101 110 111 000 001 010 011 100 101 110 111

Octal

Hexadecimal

BCD

1 2 3 4 5 6 7 10 11 12 13 14 15 16 17

1 2 3 4 5 6 7 8 9 A Β C D Ε F

1 2 3 4 5 6 7 8 9 1, 0 1, 1 1,2 1,3 1,4 1,5

ASCII (Hex)

31 31 31 31 31 31

31 32 33 34 35 36 37 38 39 30 31 32 33 34 35

Various numbering schemes are used in data interchange. Decimal, binary, octal, and hexadeci­ mal use base 10, 2, 8, and 16, respectively. Binary-coded decimal (BCD) encodes decimal digits using a four-bit binary representation. ASCII adds 48i 0 or 30 16 to the BCD values for serial trans­ mission

684 A • ANALYTICAL CHEMISTRY, VOL. 58, NO. 6, MAY 1986

This will also permit the full 256 al­ lowable 8-bit binary combinations to be used for data transmission. Some of these combinations will not "print," others may print peculiar characters, and others might be interpreted by your operating system (OS) as control characters. Your instrument may be shipping straight binary. Perhaps packed bina­ ry-coded decimal (BCD) data are be­ ing sent (Table III). Only four binary bits are needed to encode the allowed decimal numbers. Two digits can be packed into each byte of data that is shipped. Solution: Most PC serial ports have software and hardware options to se­ lect the number of data bits and pari­ ty. Check to see if these agree with the instrument's protocol. The software program in the PC must not use the standard OS serial line interrupt handler. One must be written to convert the data stream into the ASCII or number format re­ quired by your application program. Although a few OS's allow transparent binary communication, most do not. You may need professional assistance. Problem 7:1 often lose data charac­ ters or get garbled data. Many PC ac­ quisition programs run under OS's that were not intended for real-time use. Often the programs themselves

Table IV. Data formats CSV 300, 10 310,25 320, 60 330, 30 340, 15

Table 0, 1

"" Vectors 0,6

I

Ί

"Lambda" 0,300

•·%Τ" 0, 10

V

V

""

0,310

0, 25

Tuples 0,2

V

V

0,320

0,60

""

V

V

Data 0,0

0,330

0,30

V

V

""

0,340

0, 15

-1,0 ΒΟΤ

V

V

-1,0

-1,0 EOD

Comma-separated values (CSV) and data interchange format (DIF) are standard data exchange formats used for the import and export of data among instruments, computers, and programs. The DIF format stores data as vectors and tuples (rows and columns). Legend information is stored as ASCII strings between double quotes ("). BOT = beginning of tuple; EOD = end of data

are written in languages that are slug­ gish. If you experience character loss above 1200 baud it is likely that the incoming data stream is outstripping the OS-language system's ability to service interrupt requests from the se­ rial line.

When the wire length between sta­ tions on an RS-232 line grows exces­ sive or passes through a noisy environ­ ment, data distortion easily occurs. Solution: Try reducing the baud rate to a lower value. This can solve both types of problems. If there is ex-

Teknivent Times Up Old Packards Add new horsepower to your Hewlett Packard™ GC/MS instrument with a Teknivent Vector/One™ Data System. Interfaceable to all HP mass spectrometers, the Vector/One is a state-of-the-art approach to lab automation based on the popular IBM-PC series of personal computers. The Vector/One features high-speed data

acquisition of mass spectra, simultaneous selected ion recording, interactive calibration, a multitasking operating system, Wiley/NBS library and much more. Teknivent enhances your investment with a substantial in-place software library and free software revisions for the life of your unit. Call today for more information.

TEKNIVENT CORP. 10774 Trenton Ave. · St. Louis, Missouri 63132 · (314) 429-7272 · (800) 523-2921 CIRCLE 200 ON READER SERVICE CARD ANALYTICAL CHEMISTRY, VOL. 58, NO. 6, MAY 1986 • 685 A

cessive noise in the environment the transmission lines may need more adequate shielding. Problem 8: The incoming data don't look correct. The problem may be associated with the format of the data words. Instrument data are usually of the form xxx.yy with delimiters between data words. A common set of delimiters is carriage return (CR), line feed (LF), and NULL. Another common protocol separates successive values by commas (,). This is called the comma-separated variables (CSV) format. Finally, to achieve import and export compatibility with electronic spread sheets such as RS/1 (Bolt, Beranek, and Newman) or 1-2-3 (Lotus) and scientific packages such as ASYST (Macmillan) or Labtech Notebook (Laboratory Technologies) instruments may use the data interchange format (DIF). Table IV shows the same data set expressed in these two formats. Solution: Any well-written data acquisition package has software setup options to accommodate various input file options. If the program you have already selected does not match the instrument you already own, do not despair. It is possible to write programs in Assembler, BASIC, or Forth that can take an incoming data stream and convert it to a disk file with standard format. This may require professional assistance. Problem 9: Everything's fine, but the data range is peculiar. There is no standard for data formatting in today's market. The number of significant digits, scaling factors, integer vs. floating-point notation, etc., change from instrument to instrument. Protocol information may be transmitted at the beginning of the data set as a header. It may be explicitly defined in the user's manual or it may be implicit (take a guess). Solution: If header information is transmitted, your receiving program will have to use it to convert the data stream into the format required by the applications program. If no header information is sent, the receiving program must already contain the necessary constants and variables to adjust the incoming data. Problem 10: My instrument has RS-422/485 or current loop output. RS-422 is another EIA standard that accommodates higher baud rates over longer distances. It is one of two electronic protocols supporting a physical and functional protocol called RS-449. RS-422 will support speeds as high as 100 Kbaud at distances up to a kilometer. It accomplishes this by using differential receiver-transmitters. It is often implemented with tristate logic transceivers (see sidebar) that could allow a multiple number of units to be

Sign

_ _

Va BCD digit

BCD digit 1

BCD digit 2

BCD digit 3

·* Instrument

Parallel I/O port

Figure 4. A t y p i c a l parallel BCD i n t e r f a c e

"dropped" off from the same set of twisted pair lines. This multidrop capability allows the lab to have a simple local area network. Each unit responds only to its specific name as a central coordinator polls information from the various units on the net. This is the basis for the RS-485 protocol. Current loops (see sidebar) are used by many instrument vendors to provide multidrop capability and improve noise immunity. Solution: RS-232-RS-422 and RS232-current loop adapters are commercially available that allow interconnection of the two standards. Serial cards are available that will provide RS-232, RS-422, and current loop support. RS-485 requires both software and hardware polling support. Problem 11: How do I install multiple serial ports in my PC? PCs will accept several serial ports internally. Each serial port must have its own unique name—a specific address to which it responds. Serial boards have dual in-line switch packs or jumper sets that can change the name (address). In addition, each serial port must be assigned an interrupt request level that determines its priority. This is also a switch- or jumper-selectable option. Refer to the computer and peripheral manuals. The parallel digital connection Parallel ports. Many smaller instruments have BCD outputs that provide parallel information only.

686 A • ANALYTICAL CHEMISTRY, VOL. 58, NO. 6, MAY 1986

Each digit may be transmitted individually and successively (bit parallel, digit serial). Alternatively, all of the digits for a datum may be transmitted at one time (bit parallel, digit parallel). In the former only 4 bits of data need to be collected at one time. In the latter format the bit string length is determined by the dynamic range and resolution of the internal BCD converter. Many systems use 3V2 BCD digits (+1999 to -1999) plus an overrange bit. Sixteen bits of data must be captured simultaneously. If the BCD instrument output uses TTL (transistor-transistor logic) (see sidebar) it may be connected directly to a parallel port of a PC. This parallel port must have a sufficient number of input bits to handle the data string. In addition, it must have at least one output bit that can control the update line of the data latch associated with BCD output devices (Figure 4). The analog-to-digital converter (ADC) in these systems feeds BCD output to a set of data flip-flops used to latch the information. An asserted update line prevents the system from changing the latch contents while the computer is reading the data. Simple programs written in languages that allow specific peripheral memory locations to be addressed complete the interface. However, users should remember that the incoming data are in BCD, and most computer programs (and languages) implement straight binary arithmetic. A

Data pathway

CHROMA

TOGRAPHY Eight parallel data lines

Five control lines Attention

— —

Interface clear Service request Remote enable End/identify

CHROMATOGRAPHY CATALOG



Three handshake lines Data valid _ _ ^ _ _ Ready for data Data accepted



HUNDREDS OF REFERENCE CHROMATOGRAMS

• THOUSANDS OF INNOVATIVE CHROMATOGRAPHIC SUPPLIES AND ACCESSORIES



LOADED WITH TECHNICAL INFORMATION

CALL OR WRITE FOR YOUR FREE COPY ALLTECH ASSOCIATES APPLIED SCIENCE LABS

2051 Waukegan Road Deerfield, II. 60015

(312)948-8600

Figure 5. The IEEE-488 standard involves a bus that carries eight parallel data bits and uses eight additional control and handshake signals The Institute of Electrical and Electronics Engineers' standard 488 is equivalent to the American National Standards Institute MC1.1 protocol. The convention has been marketed as the Hewlett-Packard Interface Bus (HPIB), the General Purpose Interface Bus (GPIB), or the Lab Bus

BCD-to-binary conversion is usually required. Parallel printer ports may suffice, and 24- to 64-bit general-purpose parallel ports are commercially available. The address locations and interrupt request levels can be changed, just as the serial ports described above. IEEE-488, GPIB, HPIB, and ANSI MC1.1. This family of identical standards provides for a cable of eight parallel data lines, eight parallel control and handshake lines, and eight ground lines that interconnect a family of instruments (Figure 5). A 24-pin ribbon connector is used, with either tristate or open-collector T T L negative logic levels for the signal lines (see sidebar). Up to 15 instruments can be multidropped along IEEE-488 lines, which can reach 20-m lengths and communication speeds of 500 Kbytes/s (4000 Kbits/s). Interface cards and software support programs for this popular interface are available from a number of vendors. (Users of equipment made in Europe that meets this protocol should use caution. The Continental IEC 625-1 and BS 6146 standards are electrically and logically IEEE-488 compatible but specify physical protocols involving a

bvdksjvkmdnv CIRCLE 5 ON READER SERVICE CARD

688 A • ANALYTICAL CHEMISTRY, VOL. 58, NO. 6, MAY 1986

D-shaped plug that is identical to RS-232 connectors. RS-232 lines carry up to 25 V and 500 mA.) Time t o control the world

The preceding discussion has focused mainly on data collection from instruments, as most intelligent instruments control their own internal functions. If external control is required this can be performed by all three of the communication protocols described above—RS-232, binary, and IEEE-488. Binary. The fundamental control element is a binary output representing an O N / O F F request. The T T L sig-

nals generated by the basic parallel output boards need to be augmented so they can control various voltage and power elements. Solid-state relay boards are available that allow the user to control 8-16 solid-state switches with TTL inputs. These switches can control 110-220 V ac and up to 5 A. The devices are optically isolated. The TTL input generates an optical signal that travels over an internal waveguide. This light beam affects the base of a phototransistor involved in the actual switching function. ASCII. Commercial modules are

Interrupt

WESCAN

Data lines Counter

Clock Parallel port

YOUR PATH TO EXCELLENCE GET YOUR

Load • 10 MHz

Count-

FREE MUX xintrol tines

MUX

TSDWDWOO1 Hz

ION CHROMATOGRAPHY CATALOG

Divide-by-tens

Figure β. Real-time clocks are used to measure the time between events

ION CH!*0»!ATO'3ÇÎAi>KY (pmttt to eicoi/i-icp)

The clock pulse train passes through a series of divide-by-ten counters that produce successively lower frequencies (10 MHz through 1 Hz). One of these frequencies is chosen by the digital multiplexer for eventual input to a binary down-counter. This has been previously loaded by the computer. When the count-line is a logic 1, the selected clock pulse train is passed to the counter that steps toward zero. When this value is reached an interrupt to the computer is generated

available that interpret a prechosen set of ASCII characters transmitted over a serial line as the command to activate (or deactivate) a target de­ vice. Uncommon control characters are selected for this function. IEEE-488. Control of external de­ vices is an inherent part of the stand­ ard. Time. If external control of a device is required, a timing element is usually needed. The timing may be derived from the system day clock if one is present. This will suffice for low-speed applications and experiments of short duration. However, problems may arise from several sources: (1) OS calls for "time" may be slow enough that interferences occur, (2) periodic sam­ pling may require careful program­ ming at the 24-hour rollover, and (3) random differences may occur be­ tween what should be identical peri­ ods. Therefore, it is common to incor­ porate other clock-timer modules into the computer's option slots to provide controllable real-time functions. These devices (Figure 6) have pro­ grammable counters that can be pre­ loaded with numbers. Externally pro­ vided pulses cause them to count down toward zero. When timeout oc­ curs a system interrupt is generated, indicating that a real-time period has

elapsed and some service action is re­ quired. For reproducible successive periods these clocks should have the ability to reset themselves. This avoids the time loss and variability of resetting and reloading software. The time resolution of such a clock depends on the countdown value and the frequency of the pulse train. Be­ cause there is no synchronization be­ tween the pulse train and the hard­ ware or software command to start the countdown, there is usually a small timing error that can be as large as the pulse train period—a timing "glitch." High clock rates and high counter val­ ues lead to smaller glitches. Although it is possible to program complex situations with one clock, multiple overlapping asynchronous events are best handled with multiple real-time clocks. The same devices can be used to count external events. The counters are cleared, and TTL pulses derived from the external event cause a se­ quential up-count to occur. Next month we will examine the an­ alog PC connection. Acknowledgment The author wishes to thank Glen Wollenberg for his advice and direction in developing this subject material.

WESCAK INSTRUMENTS, l*C.

KEEP YOUR I

ON US

Call (408) 727-3519 Or Write WESCAN INSTRUMENTS, INC. P.O. Box 54984 Santa Clara, CA 95054-0984

CIRCLE 230 ON READER SERVICE CARD

ANALYTICAL CHEMISTRY, VOL. 58, NO. 6, MAY 1986 • 689 A