This is only a preview of the May 2003 issue of Silicon Chip. You can view 28 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. Items relevant to "WidgyBox - A Guitar Distortion Effects Unit":
Items relevant to "A 10MHz Direct Digital Synthesis Generator":
Items relevant to "Printer Port Hardware Simulator":
Articles in this series:
Purchase a printed copy of this issue for $10.00. |
The LPT Simulator will take you next to no time to build. Note that
the final version differs slightly from this prototype.
Ideal for troubleshooting
Lets you manipulate
the data & control
lines
Has 6 LEDs for
status monitoring
Low cost & easy to
assemble
Printer por t
harrdware simula
ha
imulattor
Do you need to test printers or other items
of equipment that connect to a PC’s parallel
printer port? This low-cost, easy-to-build
circuit will let you test them quickly, without
the need for a PC or test software.
By JIM ROWE
B
ASICALLY, THIS DEVICE is a
simple hardware simulator. It
allows you to manipulate the port’s
data and control lines, monitor the
status lines and even send the printer (or other equipment) a ‘strobe’
pulse.
The idea for the Printer Port Simulator came about while we was developing our Windows-based EPROM
Programmer. We struck a rather tricky
timing fault and subsequently wasted
a fair bit of time trying to work out
whether it was due to a problem with
the hardware or a bug in the software.
The same sort of problem can occur
when you’re trying to track down a
80 Silicon Chip
fault in other kinds of PC-driven equipment, of course. It can even happen
when you’re getting weird problems
with a printer.
We ended up resolving our particular problem by lashing up this
Printer Port Simulator. This allowed
us to send basic control signals to the
EPROM programmer and monitor its
status lines, without having to worry
about software debugging until later.
It proved to be very effective and enabled us to track down the cause of the
timing error.
Later on, we realised that our Printer
Port Simulator could also be used as a
general troubleshooting tool to solve
similar problems. So here it is and
there’s really very little in it – just two
cheap ICs, a +5V regulator, a couple
of DIP switches to set up the data and
control bit lines, six LEDs for status
indication, a pushbutton to produce
strobe pulses and a handful of other
components.
It all fits on a small PC board measuring 113 x 61mm and runs from a 9V
DC plugpack. The maximum current
drain with all LEDs on is just 58mA.
How it works
Refer now to Fig.1 for the circuit
details. The simulated “port interface” is provided via CON1, which
duplicates the DB25 female connector
used to provide the standard printer
port on a PC.
Pins 2-9 are used for the main data
bus (DATA 0-7) to the printer. These
pins are connected to a very simple
data input circuit which uses eight
10kΩ pullup resistors and an 8-way
DIP switch (S3). Each pole of S3 is
simply connected between one of the
data lines and ground – when a switch
siliconchip.com.au
Fig.1: the circuit is straightforward – just some DIP switches to set the data bits and control pins, a flipflop to
generate the strobe pulse and some indicator LEDs to monitor the status lines.
siliconchip.com.au
May 2003 81
Fig.2: install the parts on the PC board as shown here, taking particular
care to orientate the DIP switches correctly. In addition, switch S1 must be
installed with its flat body surface to the left.
Fig.3: this is the full-size etching pattern for the PC board. Check your board
carefully before installing any of the parts.
This means that pin 3 is normally low
and so pin 11 (the strobe-bar output)
is normally held high.
Because pin 3 is low, D1 is forward
biased and holds the voltage at the
inputs of IC1b low as well. As a result,
the output of IC1b (pin 6) is held high,
as is the pin 13 input of IC1d.
Now when S1 is pressed, the 100nF
capacitor is discharged and so a logic
low is applied to pin 1 of IC1a. As a
result, the flipflop is triggered into
switching states – ie, pin 3 goes high
and pin 11 goes low. This marks the
start of the strobe-bar pulse.
When pin 3 goes high, it removes the
forward bias on D1 and so it can no
longer pull pins 4 & 5 low. As a result,
the associated 390pF capacitor begins
charging via a 10kΩ resistor.
After about 2µs, the voltage on pins
4 & 5 rises high enough to switch IC1b.
When that happens, pin 6 of IC1b goes
low and because this pin is connected to pin 13 of IC1d, this triggers the
flipflop into switching state again. As
a result, pin 3 switches low and pin 11
switches high, bringing the strobe-bar
pulse to an end.
Note that this all takes place only
if S2d is open. That’s because if S2d
is closed, it holds both inputs of IC1b
low permanently and so prevents IC1b
from resetting the flipflop.
Basically, S2d allows you either
to produce strobe-bar pulses using
S1 (when S2d is open) or to hold the
strobe line down continuously after
pressing S1. This second mode is
handy for troubleshooting.
Status LEDs
is closed, that line is pulled to ground.
Conversely, when a switch is open
ed, that data line is pulled to logic high
(ie, +5V) by the pullup resistor. As a
result, the DIP switch can be used to
feed any desired extended-ASCII data
bit combination to the printer (or other
device) – ie, from 00 to FF hex.
Similarly, 4-way DIP switch S2 is
used to set any desired combination of
bits on three of the four control lines
of the port: ie, pin 14 (Auto LF), pin
16 (Reset) and pin 17 (Select Out).
Note that, in this case, the pullup
resistors have a value of 4.7kΩ rather
than 10kΩ.
The remaining printer control line
connects to pin 1 of the DB25 connector. This line is normally used to
send the negative-going “strobe” pulse
82 Silicon Chip
to the printer, to begin printing each
character. For correct printer operation, each strobe pulse should be a
single clean pulse about 1-2µs long.
In the simulator, we generate this
pulse each time switch S1 is pressed.
This is done by using a simple oneshot circuit formed from three gates in
IC1, a 74HC132 quad Schmitt NAND
device. NAND gates IC1a & IC1d are
connected as an RS (reset/set) flipflop
which is triggered by pressing S1. The
associated 2.2kΩ pullup resistor and
100nF shunt capacitor forma simple
“debounce” circuit.
Diode D1 and NAND gate IC1b are
used to convert the flipflop into a
one-shot multivibrator. This works
as follows: normally, pin 1 of IC1a is
held high by the 2.2kΩ pullup resistor.
Most of the remaining circuitry in
the simulator is used to drive LEDs
1-5. These are used to monitor the
“printer status” lines of the parallel
port – Acknowledge (pin 10), Busy/
Ready-bar (pin 11), Paper Out (pin
12), Select In (pin 13) and Error (pin
15).
As shown in Fig.1, the LEDs are
driven by inverters IC2a, IC2b, IC2c,
IC2e & IC2f, all part of a 74HC04 hex
inverter. Five of the 10kΩ resistors in
SIL1 are used as pullups on the input
lines, to prevent them from “floating” at an intermediate level when
the simulator is not connected to a
printer or other equipment. The series
10kΩ resistors are used for additional
protection against electrostatic charge
damage to the gate inputs.
IC1c and IC2d are used to drive
siliconchip.com.au
LED6, which indicates the status of
the strobe-bar line. This LED is illuminated when the line is low (because
this line is nominally active low) and
is off when it’s high.
Of course, the narrow nature of the
strobe-bar pulse means that in pulse
mode (S2d open), the LED glows so
briefly it’s not easy to see. LED6 is
therefore used mainly to verify the
quiescent level on the line and of
course, the level in non-pulse mode
(S2d closed).
Power supply
The only part of the circuit we
haven’t talked about yet is the power
supply. This is very simple, consisting purely of a 7805 regulator (REG1)
to produce a stable +5V rail from an
unregulated 9V DC plugpack. Series
diode D2 provides reverse polarity
protection, while the 470µF and 100µF
electrolytic capacitors provide filtering and stability.
Construction
Everything fits on a single-sided
PC board measuring 113 x 61mm and
coded 07105031. This is possible
because we’ve used board-mounting
components for DB25 socket CON1,
DC input connector CON2 and pushbutton switch S1. In fact, the board is
designed to be freestanding, supported
by four small screw-on rubber feet (one
on each corner).
Fig.2 shows the parts layout on the
PC board. As can be seen, the display
LEDs, DIP switches and pushbutton
switch S1 are all arranged along the
front of the board, for ease of use.
Conversely, the two connectors are
at the rear, to allow convenient cable
connections.
The assembly should take you next
to no time. Begin by fitting the two
connectors, then the three wire links,
the DIP switches and pushbutton
switch S1. Note that the DIP switches
must all be fitted with their “ON” side
towards the front of the board – they
may look upside down but this gives
the correct switching sense.
Take particular care when installing
switch S1. It must be installed with its
flat body surface to the left –ie, one
parallel pair of pins to the front and
the other parallel pair to the back. If
it’s installed incorrectly, you’ll get
a permanent short across the 100nF
capacitor and the switch won’t work.
Next, install the resistors and the SIL
resistor array. That done, you can fit
the small capacitors and the electrolyt
ics. Be sure to fit the latter with the
correct polarity, as shown on Fig.2.
The semiconductors can now all be
installed. These include the diodes,
LEDs, regulator and ICs. As usual, take
care with the polarity of each of these.
Note that all six LEDs are fitted with
their cathode “flat” side towards the
rear of the PC board.
Regulator REG1 is mounted horizontally on the top of the board, with
its three leads bent downwards at 90°,
5mm away from the body. Its metal
tab is then secured to the board using
an M3 x 6mm machine screw and a
nut underneath. This also provides a
small amount of heatsinking, as there’s
a rectangle of copper underneath as
well (there’s no need for a separate
heatsink).
Your simulator board should now
be complete, apart from fitting the four
rubber feet. These are fitted using M3
x 9mm machine screws passing up
from underneath and fitted with nuts
on the top.
Parts List
1 PC board, code 07105031,
113 x 61mm
1 PC-mount pushbutton switch
(S1)
1 4-way DIP switch (S2)
1 8-way DIP switch (S3)
1 DB25 female connector, PCmount (CON1)
1 2.5mm DC socket, PC-mount
(CON2)
1 9V 150mA DC plugpack
4 small rubber feet
4 M3 x 9mm machine screws
with hex nuts
1 M3 x 6mm machine screw with
hex nut
Semiconductors
1 74HC132 quad Schmitt NAND
gate (IC1)
1 74HC04 hex inverter (IC2)
1 7805 +5V regulator (REG1)
6 3mm red LEDs
1 1N4148 silicon diode (D1)
1 1N4004 1A silicon diode (D2)
Capacitors
1 470µF 16V PC-mount electrolytic
1 100µF 16V PC-mount electrolytic
3 100nF monolithic or ceramic
1 390pF ceramic
Resistors (0.25W, 1%)
14 10kΩ
1 2.2kΩ
3 4.7kΩ
6 330Ω
1 8 x 10kΩ SIL array
Check-out time
It’s very easy to give the completed
simulator a quick check-out. First, set
DIP switches S2a-S2d to their OFF
positions (ie, towards the rear) and
connect a 9V DC plugpack to CON2.
That done, apply power and check that
the first five LEDs light. If they do, use
your DMM to check the supply voltage
at pin 14 of either IC1 & IC2 – it should
be close to 5.00V.
At this stage, LED6 should be off.
Now set S2d (the leftmost DIP switch
in S2, nearest the pushbutton) to ON
and press S1. LED6 should now light
and stay that way, unless S2d is turned
OFF again.
If all of the above happens as expected, your simulator is working
correctly and ready for use. If not,
turn off the power and look for faulty
solder joints and components fitted
with reversed polarity. These are the
only likely causes of problems with
SC
such a simple project.
Table 1: Resistor Colour Codes
o
No.
o
14
o 3
o 1
o 6
siliconchip.com.au
Value
10kΩ
4.7kΩ
2.2kΩ
330Ω
4-Band Code (1%)
brown black orange brown
yellow violet red brown
red red red brown
orange orange brown brown
5-Band Code (1%)
brown black black red brown
yellow violet black brown brown
red red black brown brown
orange orange black black brown
May 2003 83
|