MODEL 140
                      15-BIT A/D CONVERTER

                                            LAWSON LABS, INC.
                                            3217 Phoenixville Pike
                                            Malvern,  PA 19355

                                               610 725-8800
                                                    or
                                               800 321-5355

Rev. B

                       TABLE OF CONTENTS

INTRODUCTION                                        Page 2

1.  INSTALLATION                                    Page 2

2.  PERFORMING CONVERSIONS                          Page 3

3.  CHANNEL SELECTION                               Page 5

4.  CONTROL OUTPUTS & DIGITAL INPUT                 Page 6

5.  OPERATING SUGGESTIONS                           Page 7

6.  TROUBLESHOOTING                                 Page 9

7.  INTERNAL ADJUSTMENTS                            Page 9

8.  SPECIFICATIONS                                  Page 10

WARRANTY                                            Page 11

INTRODUCTION

     The Lawson Labs Model 140 Analog Interface card enables an
IBM PC computer to translate continuously variable analog
voltages into their digital equivalents of ones and zeros. It
also provides a means for the computer to turn external equipment
on and off. These functions are the basics of monitoring and
control systems. Both the analog inputs and the digital outputs
are protected against overvoltages.

     The Model 140 uses only four memory locations out of the 32
designated for a "prototype card." These four addresses can be
changed by altering the switch settings on the Analog Interface.
This arrangement minimizes the chance that there will be a
conflict between the Model 140 and any other peripheral card.

SECTION 1.    INSTALLATION

NOTE: Always handle circuit cards by the edges.

     There are four small switches in the upper left corner of
the Model 140. Make certain that switch 4 is in the "ON" position
and that the other three switches are in the "OFF" position. This
will map your Analog Interface into input locations 772 through
775. If you have another special function card in your computer
which uses these locations, see Section 2 for alternate mapping.

     Static electricity can damage computer circuitry so care
should be taken to control static discharge. Turn off the
computer but do not unplug it. Remove the cover.

     First remove the screw which secures the bracket behind a
vacant slot. Then remove the bracket. While holding the Model 140
in one hand touch the computer's chassis with the other. This
procedure will harmlessly drain any static charge that may be
present. Now insert the card into the connector. Press down
firmly to insure that the card is seated and replace the screw in
the bracket.

     Attach a pair of wires to pins 6 and 13 of a mating 15-pin
connector. The negative input is pin 13 and the positive input is
pin 6. The other end of the wires should connect to the voltage
being measured. A 1.5 volt battery is a convenient voltage source
for test purposes. For a battery or other floating voltage
source, a connection must be made between the negative input and
ground. The computer's chassis is the best ground for most
purposes.

NOTE: Strain-relief is recommended for all permanent wiring on
the connector. Otherwise, physical stress may cause the failure
of an electrical connection. Hoods are available, from Lawson
Labs and elsewhere, with a built-in strain-relief clamp. 

FIGURE 1.    CONNECTOR PINOUT

PIN 8...CHANNEL 1+
                     PIN 15...CHANNEL 1-
PIN 7...CHANNEL 2+
                     PIN 14...CHANNEL 2-
PIN 6...CHANNEL 0+
                     PIN 13...CHANNEL 0-
PIN 5...CHANNEL 3+
                     PIN 12...CHANNEL 3-
PIN 4...GROUND
                     PIN 11...DIGITAL INPUT
PIN 3...GUARD
                     PIN 10...OUTPUT C
PIN 2...OUTPUT D
                     PIN 9....OUTPUT B
PIN 1...OUTPUT A

    Attach the connector and tighten the small screws that hold
the halves together. Replace the cover. Turn on the power to the
computer. If the power-on self-test (POST) does not behave
normally, turn off the computer and refer to the troubleshooting
section of this manual.

     Connect the plus and minus wires to the voltage being
measured. Make certain that the  voltage is in the +/- 5 volt
range. If the voltage source is floating in relation to ground,
e.g. a battery, also connect the minus side of the voltage being
measured to ground. For that ground connection, use a ground pin
on the Model 140's connector or, preferably, chassis ground at
the computer. If the computer chassis is not accessable, use the
ground pin of a grounded wall outlet. Remember that the negative
input on the Analog Interface should both stay reasonably close
to ground potential. See FIGURE 4.

NOTE: For maximum reliability, connect all unused inputs to
ground.

SECTION 2.    PERFORMING A/D CONVERSIONS

     In the absence of other instructions, the Analog Interface
card will measure the voltage at input channel #0. Because the
wires that you attached are connected to input #0, we need not
concern ourselves with the channel selection process at this
time.

     The Model 140 uses four port addresses. Two are for input
only and two are for both input and output. If your computer
contains other special-purpose cards, the possibility of conflict
arises. Compare FIGURE 2 with the documentation of other
special-purpose cards present and select switch settings that
avoid port conflicts. Only one switch should be on at a time.

FIGURE 2.    DIP SWITCH SETTINGS

SWITCH 4 ON,          INPUT:  PORTS 772-775       ADC = 772
OTHERS OFF            OUTPUT: PORTS 772 & 773

SWITCH 3 ON,          INPUT:  PORTS 780-783       ADC = 780
OTHERS OFF            OUTPUT: PORTS 780 & 781

SWITCH 2 ON,          INPUT:  PORTS 788-791       ADC = 788
OTHERS OFF            OUTPUT: PORTS 788 & 789

SWITCH 1 ON,          INPUT:  PORTS 796-799       ADC = 796
OTHERS OFF            OUTPUT: PORTS 796 & 797

     Substitute the ADC (Analog to Digital Converter) number from
FIGURE 2 in line #10 of the following BASIC program if an
alternate switch setting is used.

   10 ADC = 772: START = ADC + 1
   20 OUT START, 0: REM START CONVERSION
   30 GOSUB 1000: REM READ ANSWER
   40 LOCATE 1,1: PRINT COUNT/4000: REM SCALE IN VOLTS
   50 GOTO 20
   1000 WAIT ADC, 128, 128: X = INP(ADC)
   1010 COUNT = X MOD 16 + (INP (ADC + 1) MOD 16) * 10 +
       (INP (ADC + 2) MOD 16) * 100 + (INP (ADC + 3) MOD 16)
       * 1000
   1030 IF X AND 32 THEN COUNT = COUNT + 10000
   1040 IF X AND 64 THEN COUNT = -COUNT
   1050 RETURN

      Line 10 assigns variable names to the port addresses. Line
20 begins the conversion. Line 1000 waits for the conversion to
finish then sets the temporary variable X equal to INP (ADC). INP
(ADC) MOD 16 is the least significant digit of the answer, INP
(ADC + 1) MOD 16 is the tens place of the answer, etc. In line
1010 the four least significant digits are weighted and added to
equal COUNT. In line 1030 a flag bit is tested. If bit 5 is a
one, then the most significant digit of the answer is a one. The
most significant digit has a weight of 10000 so 10000 is added to
the COUNT. Line 1040 tests a flag at bit 6. If bit 6 is a one
then the answer is negative. Line 40 displays the result in
volts. The count will be between -19999 and +19999. Each count
represents a quarter of a millivolt. Line 50 repeats the process.

     RUN the program. (Use Ctrl Break to exit.) The voltage
should appear in the upper right-hand corner of the screen. The
Model 140 Analog Interface resolves 1/4 of a millivolt. To scale
the answer in millivolts, the COUNT should be divided by 4. To
scale in volts, the COUNT should be divided by 4000. A fresh D
cell should read about 1.5 volts (6000 counts). Connecting the
input wires directly together will cause a potential of zero
volts. The reading with the input shorted should be within 0.75
millivolts (3 counts) of zero. An open circuit or overvoltage
will read unpredictably. Be aware that an overvoltage can give a
reading of 2500.0 millivolts. The input channels are protected
against overvoltages of up to 200 volts. Reverse the wires and
note the polarity change. Note that the plus sign is implicit and
does not appear.

     The conversion itself takes 134 milliseconds (approximately
1/7 of a second). If the WAIT immediately follows the START
instruction the computer will mark time until the 134
milliseconds are over. The computer can use that time to do other
things if those appear between the START and WAIT instructions in
the program. If the conversion is already over when the WAIT
instruction is encountered, then no delay will result. To obtain
a higher sampling rate add this line to the above listing:

   1020 OUT START, 0

     Also change line 50 to GOTO 30. Now the next conversion will
be in progress while the last one is being processed and printed.

SECTION 3.    SELECTING OTHER INPUT CHANNELS

     First connect the other voltage to be measured to an unused
pair of input pins on the Model 140's connector. See Figure 1.
The four available channels are numbered 0 through 3. To select a
channel, substitute the channel number to be selected for the "x"
in this instruction.

        OUT ADC, 16 * x

     Channel 3 could be selected using the instruction OUT ADC,
48 or OUT ADC, 16 * 3.

    Here is a sample routine which will measure the voltage at
each channel and print the data:

   10 ADC = 772: START = ADC + 1
   15 FOR N = 0 TO 3
   20 OUT ADC, 16 * N: REM SELECT CHANNEL N
   25 OUT START, 0: REM START CONVERSION
   30 GOSUB 1000: REM READ ANSWER
   40 PRINT COUNT/4000: REM SCALE IN VOLTS
   50 NEXT N
   60 END
   1000 WAIT ADC, 128, 128: X = INP(ADC)
   1010 COUNT = X MOD 16 + (INP (ADC + 1) MOD 16) * 10 +
       (INP (ADC + 2) MOD 16) * 100 + (INP (ADC + 3) MOD 16)
       * 1000
   1030 IF X AND 32 THEN COUNT = COUNT + 10000
   1040 IF X AND 64 THEN COUNT = -COUNT
   1050 RETURN

     Running this program with no connections made on channels 1
through 3 will do no harm. However, the data from those channels
will be meaningless. Notice that after the program has run,
channel 3 is still selected. An OUT START, 0 instruction would
measure the voltage at channel 3. Turning the power off and on or
OUT ADC, 0 will reselect input zero.

     To speed up the sampling, the same principle can be applied.
Add the following line to the above listing to create an
all-purpose subroutine:

     1020 OUT ADC, NEXTCHANNEL: OUT START, 0

     Set NEXTCHANNEL equal to the selection code for the channel
to be sampled next and GOSUB 1000. The routine will return, as
before, with COUNT equal to the result of the last conversion and
with the next conversion in progress.

SECTION 4.    USING THE CONTROL OUTPUTS & DIGITAL INPUT

     There are four optically isolated output lines on the Analog
Interface card. These are intended primarily for expanding the
number of input channels using an external multiplexer. Any
channel can be expanded to 16 channels with an external
multiplexer. The optically isolated control lines prevent ground
loops from being formed. Configurations of up to 64 analog inputs
are possible with four Model 17 Multiplexers. The outputs can
also be used for digital control. Think of each one as a contact
closure to guard.

     The output port has the same address as the input channel
selector. The lower four bits appear, optically isolated, at the
connector. A number from 0 to 15 sent to port ADC will appear on
the output lines, coded in binary. The instruction OUT ADC, 3
will cause outputs A and B to become active. Below is a list of
codes and the corresponding active outputs. Note that the
sequence is that of counting in binary. 1=active.

FIGURE 3.    OUTPUT CODES

  CODE           OUTPUT  D C B A

   0                     0 0 0 0
   1                     0 0 0 1
   2                     0 0 1 0
   3                     0 0 1 1
   4                     0 1 0 0
   5                     0 1 0 1
   6                     0 1 1 0
   7                     0 1 1 1
   8                     1 0 0 0
   9                     1 0 0 1
   10                    1 0 1 0
   11                    1 0 1 1
   12                    1 1 0 0
   13                    1 1 0 1
   14                    1 1 1 0
   15                    1 1 1 1

     If it is necessary to alter the output code without
affecting the input channel selection, the input selection code
should be added to the output code. For example, to select input
channel 1 with output code 15 use OUT ADC, 16 + 15 or OUT ADC,
31.

     Electrically, each output line is the collector of an
optically coupled NPN transistor whose emitter is connected to
guard. Each output line can drive two low-power TTL loads or many
CMOS loads. An external pull-up resistor (from the collector to
the external positive supply) must be used. Typically, 20 K ohms
for low-power TTL or 47 K ohms for CMOS is appropriate. When the
output code is 0 all four phototransistors are off and no current
is drawn through the transistors. If the input to an inverting
buffer is connected to output line A (with the appropriate
pull-up resistor), the input level is forced high by the resistor
so the buffer output would be 0. If the output code is 1, the A
transistor will turn on and pull the buffer input to a logic
level 0. The buffer output will then be a logic level 1.

     The digital input can be a contact closure to ground or a
TTL or 5 volt CMOS logic level, active low. This line reads the
digital input.

     IF (INP(ADC) AND 16) THEN PRINT "off" ELSE PRINT "on"

SECTION 5.    OPERATING SUGGESTIONS

     The Analog Interface features fully differential inputs. A
basic understanding of differential measurements will help you to
use your card to best advantage. The plus and minus input pins
should be wired directly to the voltage being measured. In this
way, it is assured that the only current flowing in the wires
will be the input current of the A/D converter. Because the wires
have finite resistance, any current flowing will cause a voltage
drop and a corresponding error. The Analog Interface card
requires a vanishingly small input current so the error caused by
even very long wires is negligible. For proper operation of the
Analog Interface it is necessary that the negative input be
reasonably close to ground potential. For a floating voltage
source, this is generally accomplished by connecting a third wire
between the computer chassis and a ground terminal at the source
of the measured voltage. Ground currents may flow in this wire,
but the resulting voltage drop will not cause a measurement
error. If the source of the voltage being measured is a
line-connected device with a three-pronged plug, its output
voltage is likely to be referenced to ground. In that case, no
ground connection should be made or a ground loop will be formed.
Ground loops can cause unpredictable behavior.

FIGURE 4.    TYPICAL INPUT CONNECTIONS

     The Model 140 has excellent intrinsic noise rejection.
Still, accuracy is sometimes limited by electrical noise that
travels through the air and is picked up by interconnecting
wires. The first defense against noise is shielding. If you
suspect noise problems, use shielded wire with the shield
connected at one end to ground. Sometimes twisting together the
plus and minus wires on an input to form a twisted pair will
eliminate pick-up. If noise problems persist, try to locate the
source of the interference and shield it. Electric motors,
electric heaters and flickering fluorescent lights are potential
sources of interference.

     Programmers should note that the lower 4 bits at the input
ports are the conversion result in binary coded decimal (BCD).
The least significant digit is at address ADC, the next digit at
ADC+1, etc. The upper 4 bits are always the same. The most
significant bit, bit 7, is a "converting" bit, bit 6 is the sign
bit, bit 5 is the 10 thousands count (0 or 1), and bit 4 is the
digital input.

Note: When programming in C, assembly or other fast languages,
you will need to add a 1 millisecond delay after the status check
and before reading the registers.

SECTION 6.    TROUBLESHOOTING

GENERAL:

     If the A/D converter appears not to be working, first check
all external wiring and all port addresses. Double check the
switch settings on the Model 140. Be sure that all input voltages
are within range. If another special function card is present,
check for conflicting port addresses. Also, try adding a wire
from the negative input to ground.

1:  Results seem to be meaningless numbers

     The most likely culprit is a loose wire or an input with
nothing attached. Try connecting the + and - inputs to ground. If
the voltage does not read within 0.75 millivolts of zero, the
problem is in the wires themselves or in the channel selection.
Check that the program has been correctly entered.

2:  The computer hangs up and requires a Ctrl Break to resume
operation after trying to read a voltage.

     The ADC port address is wrong or in conflict with another
card. The computer is WAITing indefinitely for the conversion to
finish.

3:  Readings show excessive scatter.

     First check for proper grounding. If there is no connection
between the negative input and ground, try one. If there is such
a connection, try removing it.

     If the card reads zero volts properly but still returns
widely varying numbers when measuring a voltage, the voltage
could be oscillating or noisy. If you check the voltage with
another voltage-measuring device remember that some meters will
average out oscillations or noise to produce a steady reading.
Try switching to an alternating current scale. If you get a
reading the voltage is certainly unsteady. The Analog Interface
will filter out high frequency noise. However, any oscillation
below 50 cycles per second can cause increased scatter.

SECTION 7.    INTERNAL ADJUSTMENTS

     The only adjustment on the Analog Interface card is a gain
control. This adjustment varies the reference voltage used during
the A/D conversion. The long-term stability of the initial
calibration is excellent. If you decide to alter the original
gain setting, be sure your voltage reference or test meter is
sufficiently accurate and has been calibrated recently. Remember
that if you change the gain setting you may not be able to
restore the converter to its original accuracy.

     The gain adjustment potentiometer is at the top edge of the
Analog Interface Card at the rear. A clockwise rotation will
reduce the reading.
It is best to make any adjustment with the card at its normal
operating temperature.

SECTION 8.    SPECIFICATIONS

TYPE:                  Dual slope A/D with automatic zero
                       and automatic polarity control

INPUT
RANGE:                 +4.75 to -5 volts guaranteed
                       +/-5 volts typical

RESOLUTION:            0.25 millivolts

LINEARITY:             0.005% of full scale

ACCURACY:              0.025% of full scale
                       at normal operating temperatures

INPUT
IMPEDANCE:             1000 megohms typical

CONVERSION
TIME:                  134 milliseconds

ANALOG
INPUTS:                4 channels fully differential
                       protected to 200 volts

DIGITAL
INPUT:                 Contact closure to ground
                       or TTL or 5 volt CMOS logic level

OUTPUTS:               4 latched optically isolated channels
                       protected to 200 volts
                       Each output will drive two low-power TTL
                       loads or many CMOS loads

TYPICAL POWER
CONSUMPTION:           +5v....160 milliamps
                       +12v...17 milliamps
                       -12v...15 milliamps

SIZE:                  3.9 x 6.75 inches
                       0.625 inches maximum height

                     LIMITED WARRANTY

     The Lawson Labs, Inc. Model 140 Analog Interface is
guaranteed against defects in materials and workmanship for a
period of one year from the date of delivery. Products must be
returned to Lawson Labs for warranty service. Contact Lawson Labs
at 800 321-5355 for return authorization before returning
anything for service.

     The above warranty is in lieu of all warranties express or
implied. Lawson Labs will not be liable for indirect or
consequential damages caused by any defect in this product. Some
states do not allow the limitation of consequential damages, so
the above exclusion may not apply to you.