This is only a preview of the March 1991 issue of Silicon Chip. You can view 43 of the 96 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Articles in this series:
Articles in this series:
Articles in this series:
Articles in this series:
Articles in this series:
Articles in this series:
|
Multi-purpose 1/0
board for IBM PCs
Ever wished you had an "add-on" board so that
your PC could directly control external devices
such as domestic appliances & motors? Perhaps
you want to experiment with process control or
robotics. If so, this plug-in board and its
accompanying software could be the answer.
By GRAHAM DICKER
The standard IBM parallel port is
an under-used facility on most computers and can provide a terrific resource as an I/O facility. The main
problem is that normally you need to
breadboard up an interface to' use it.
That's where this I/O board comes in.
The MAX-386 I/0 board contains a
versatile arrangement of facilities as
outlined below:
• 7 SPDT relay ports, each rated at 2
amps.
• 8 switch or pushbutton input lin es,
each only requiring a grounding contact: TTL compatible.
• 1 digital to analog converter (DAC);
4-bit precision, 0-2.5V
• 1 analog to digital converter (ADC);
20-bit precision (if using a 386-based
system) or 16-bit (AT) converter. Using single slope conversion.
• 4 open collector outputs able to
switch 1 amp at voltages up to 60
volts DC; each output reverse protected.
• 4 motor drive outputs (up to 40mA
each) for low voltage (3V) DC motors.
These can be also used for TTL outputs.
• 1 programmable timer output (by
linking DAC output into ADC input).
Maximum output current 200mA<at> 5
volts.
What has been done with the MAX386 board (or MAX for short) is to put
together a lot of interfaces in a flexible configuration on one PC board.
For example, if the DAC facility is
required, the relay outputs can be
used to control the outside world, or
if more switch inputs are required,
the relays can be wired up as an input
multiplexer (MUX).
Also, if more ADC channels are
required, the same relays can be wired
as an analog MUX. In some applications, more switched outputs are
sometimes needed, so some combination logic can be worked out using
the relays.
The printer port
Usually, the IBM PC has three standard addresses available for the printer ports: LPT1=378H, LPT2=278H,
LPT3=3BCH. Each of these addresses
has three registers, of which not all
bits are available.
Port availability
The multi-purpose 1/0 board features a programmable timer, seven SPOT relay
ports, four open collector & four motor drive outputs, & AID & DIA converters.
66
SILICON CHIP
Although the MAX board is designed to be used in conjunction with
a standard parallel printer port, some
ports are not as standard as others.
The main differences are that some
inputs and outputs for status bits are
inverted. Because of this, the software examples given are for the machi nes I have tested as being compatible. To run on non-standard ports,
you may have to make small software
changes to invert some lines.
MAX uses the first register of the
parallel port for the seven relays and
the select line for reading the input
switches.
This line also doubles as the trigger
line for the Timer/ ADC.
·
The second register in the set is
used to read the multiplexed input
lines and the output of the ADC/
Timer.
.12v
TTL OUT
J3
0AC17
01
1N914
0/C OUT
J4
5D
~;
PORTA
378
J1
0020---"IWr--=+--I
C 011
EM401
T
~:
~:
~::
~::
~::
RLA7
-12V
~:
0216
4C
C 010
EM401'
.,.
.,.
3B
.,.
2A
001
C
08
EM401
.f
.,.
.,.
•5V
0.1J
PORTS
379
J1
0315
16
TTL IN
J3
4 A1
0413
0512
3 A2
12
2 81
06 10
1 82
0711
8 C1
IC6
74LS157
MUX
220k
13
TIMER OUT J3-1 0
7 C2
6 01
IC5
555
5 02
AOC IN J3-9
0791 "---------------------------+--◄
B
EOc
VIEWED FROM
BELOW
~
EC
,.
+
4.7
16VW+
s;
15
.,.
8
.,.
MAX 1/0 BOARD
Fig.I: the MAX 1/0 board interfaces to the parallel printer port of any IBM or
IBM compatible computer and uses it to control relays, motors or TTL inputs.
The last port is used to output to
the DAC, TTL, Motor and O/C outputs As such, individual control of
the last group is not possible, but a
single output of a group or an entire
group can be controlled appropriately.
For example, if you are using the 1
amp O/C switched outputs, you cannot use the DAC but you could use
two O/C outputs and two TTL outputs. The relay and input ports, how-
1 SEL A/B
ever, can be used concurrently.
Now have a look at the circuit diagram of Fig.1.
The relay outputs
The relay outputs are driven from
bits D0-D6 from register 1. A 3.3kQ
resistor limits the base current of the
7 BC547 inverter transistors and another 3.3kQ in the collector of these
transistors limits the base current of
the following 7 BC557 relay driver
transistors.
24V relays with a coil resistance of
7400 are used to reduce the total relay current drain. With all seven 24V
relays , the total current drain from
the combined ±12V rails is only
220mA. Since each relay coil draws
only about 30 milliamps, 1N914 signal switching diodes are adequate as
back-EMF suppressors to protect the
relay driver transistors.
The relays used are DPDT types
with the contacts paralleled for inMARCH 1991
67
creased current capacity. Each set of
relay connections is terminated in a
0.1-inch pitch SIP header (JZ).
TTL/switch inputs
A total of eight inputs connect (J3)
to a 74LS157 quad 2-input multiplexer, IC6. When the logic level at
pin 1 is low (O), the 1-inputs (ie, Al,
B1, Cl & D1) are selected. When the
logic level on pin 1 is high (1) , the 2inputs (ie, A2, B2, CZ & DZ) are selected. The outputs from IC6 are then
taken to the register 2 address inputs
(379H) .
On some computers, these lines are
inverted and will need some software
to sort this out. The select line to the
74LS157 comes from register 1 address (378H) bit D7. As the inputs are
TTL compatible and float high, a
grounding switch is all that is required
to be detected as an input.
Open collector outputs
MAX provides four open collector
(O/C) outputs and can be provided
with a second option of sinking more
current by using BD679 Darlington
transistors instead of the BD135 devices for Q15, Q16, Q17 & Q18. The
BD135 will sink about 1 amp whereas
BD679s will sink about 5 amps.
A 3.3kQ resistor limits the base
drive current to the output transistors, while an EM401 diode provides
Where to get the kit
A kit of parts for the multi-purpose 1/0 board described here is available
from PC Computers, who own the design copyright on this project. ·
The full kit of parts, including PC board and software disc, is available as
an introductory offer to SILICON CHIP readers for $149 plus $10 postage
and packing (offer valid until end of June 1991 ). The fully built and tested
MAX board costs $269 plus $10 postage and packing . Or you can buy just
the MAX PC board, instruction manual and software disc for $39.95 plus
$1 O postage and packing.
For further information, contact PC Computers, 36 Regent Street, Kensington, SA 5068 . Phone (08) 332 6513 or Fax (08) 364 0902.
68
SILICON CHIP
Fig.2: the MAX board is single sided
so it uses a number of wire links.
Assembly shouldn't take long & you
should have it up & running in about
an hour or so.
the back EMF protection in each case.
These devices are driven from the
buffered outputs of the 7408/00s, ICs
1, 2, 3 & 4. (Yes, these ICs can be
7408s or 7400s, as we'll explain in a
moment).
A single IC is used for each bit as
some printer ports invert these lines.
It is an easy change to replace the
7408 non-inverting device with a 7400
inverting device and hence use standardised software. A separate ground
return line is available for the common emitters on J4. By writing applicable software, the O/C outputs can
be used to easily drive stepper motors and an example program is provided on the accompanying disc.
TTL/motor drive outputs
These outputs are individually
buffered by the four 7408 devices and,
as mentioned above, each one may be
interchanged for non-standard printer
ports to fix the problem of inverted
lines.
The outputs of the whole package
are paralleled to provide up to 40mA
capacity which is adequate to drive
PARTS LIST
1 PC board (only available from
P.C. Computers)
1 26-way IDC to O825M cable
7 .309-251 24V 750Q coil DPDT
relays
14 T0-92 transistor insulators
1 26-way IDC DIP header
1 22-way SIP header
1 18-way SIP header
1 5-way SIP header
1 0.5-metre length of tinned
copper wire
1 8-pin DIP socket
4 14-pin DIP sockets
1 16-pin DIP socket
Connecting the 1/0 board to your computer is easy - you simply plug it into a
vacant expansion slot. Check that nothing shorts against the other boards.
small 3V DC motors or normal TTL
loads.
D-A converter (DAC)
The DAC is a 4-bit (16 level) device
using a R/2R ladder network on the
outputs of the four 7408 devices. In
the normal configuration using the
7408 buffers, the DAC output is in
inverted mode. The maximum output voltage is approximately 2.5V DC.
A-D converter (ADC)
The ADC is a unique design in that
the usual way computer designers,
like IBM and Apple, implement the
games port is to use a timer IC like the
555, but always use a variable resistance from the timing junction to
ground. This is fine if all you want to
use is a variable resistor between specific values for measurements, but the
real world measures voltages.
The principle behind this ADC is
that it uses the pulse width modulation (PWM) of the 555's pin 5 to set
the threshhold reference voltage on
its internal comparators. The 555 (IC5)
is set up as a 1-second monostable
and the trigger input (pin 2) is triggered from register O bit D7 going low.
This starts the timeout.
As the timer is timing out, the software counter counts program loops.
The faster the computer the more
loops that can be counted and hence
(within reason) the higher the resolution. For example, a 45MHz 386 was
tested with a compiled version of the
sample software (using Microsoft
Basic-7) and a count of 2 22 was
reached with the input vo ltage at 5
volts, at the end of th e timeout. By
comparison, my slow workhorse
4.77MHz XT will only count up to
about 1600 using GWBASIC, a resolution of about only 12 bits.
Assembly
The MAX is built on a single sided
fibreglass PC board with the minimum of wire links. A double sided
PC board could have been used but
the only lines that are picked up from
the IBM bus are the power supply
rails, +5V and ±12V. As such, the
MAX board can be used with any
computer provided that the IBM I/O
compatibility is preserved, and an
external power supply is wired to the
31-way 0.1-inch pitch edge connector.
Fig.2 shows the layout diagram.The
first step is to insert all the wire links
and the resistors which lay flat on the
board. The remaining resistors and
the two capacitors can now be loaded,
with the three DAC 4. 7kQ resistors
being mounted upright.
The TO-92 (BC5 5 7/BC54 7) transistors can now be loaded, but ensure
that the TO-92 spacers are placed under each transistor between the transistor and the PC board. These spacers ensure adequate ventilation, mechanical stability, and that soldering
lead temperatures are not exceeded.
At this stage , the IC sockets can all be
installed, followed by the remaining
transistors an d diodes.
The assembly can now be completed by soldering in the IDC pin
Semiconductors
4 74LS08 quad dual input AND
gates (IC1-4; see text)
1 NE555 timer (IC5)
1 74LS157 quad dual input
multiplexer (IC6)
7 1N914 diodes (01 -07)
4 EM401 diodes (08-011)
7 BC547 transistors (01-07)
7 BC545 transistors (08-014)
4 80135 transistors (015-018)
Capacitors
1 4.7µF 16VW electrolytic
1 0.1 µF metallised polyester
Resistors (5%, 1/4W)
1 220kQ
3 4.7kQ
510kQ
183.3kQ
headers and the relays.To test the
MAX board, first do a visual check to
ensure that there are no splats of solder or shorts on the board. Clean off
all flux and apply a sealing coat to the
bottom of the PC board, making sure
that the edge connector is masked off.
Plug the MAX board into the expansion bus of your computer and
the · DB25-M plug into a parallel
printer connector. The test programs
supplied with the kit are all written
in BASIC and can be used in interpreted or ·compiled versions. All of
the programs will display an identification header and ask for the port
address location being used. If you
don't know, then try them all.
No exits are provided from the program so the usual CTRL-C or CTRLBreak is the easiest exit. These programs can also be used as the basis of
your own application programs. SC
MARCH 1991
69
|