CUCPS people don't need to worry about these unless the dongle appears to have broken... Most of the software issues noted in the text are taken care of by the punchcard.pl script.
The 4070's interface is remarkably similar to a Centronics port. However, some signals are inverted and there are slightly different timing requirements. I use the following circuit, which definitely works with TTL board v2, should work with TTL v1 and might even work with the DTL version if you're lucky... (Hint for people with the DTL board: check that the voltage output for a logic one is five volts and not six (PR is a good signal line to check as it should remain high if the punch is not in use.) If Vhigh is 6V this circuit probably won't work (you might be able to modify it by putting zeners across the outputs from the punch...))
ASCII Art Alert!
PC 4070 IC1c (1) /STROBE ---------|>o---------- PI (11) IC1a (11) BUSY ---------o<|---------- PR (12) IC1b (15) /ERROR ---------o<|---------- ERR (20) (12) PE ---------------------- TL (21) (2) D0 ---------------------- Ch1 (1) (3) D1 ---------------------- Ch2 (2) (4) D2 ---------------------- Ch3 (3) (5) D3 ---------------------- Ch4 (4) (6) D4 ---------------------- Ch5 (5) (7) D5 ---------------------- Ch6 (6) (8) D6 ---------------------- Ch7 (7) (9) D7 ---------------------- Ch8 (8) (25) GND ---------------------- GND (25) +----- Ch9 (9) | +----- 6V (24) --+--- 6V (from 4070 pin 24) | ### ### 180 ohms ### | +------+----- 5V for IC1 | ___/ / ^ / \ Zener diode, Vz = 5.1V /___\ | ---+--- 0V (from 4070 pin 25)
IC1 = 74HC14, hex Schmitt inverters. The precise gate isn't critical, the family might be (you want CMOS for the low power consumption and greater Vcc tolerances. It's also nice to have Vhigh about 4.5V.)
I've built this circuit into a little interface box small enough to plug directly into the back of the Facit. You can then use a 25pin straight-through cable to connect the box to the PC's printer port.
The timing requirements of the 4070 don't fit standard Centronics
requirements. In particular, the 4070 requires the PI pulse (/STROBE) to
be between 10us and 3ms, which is somewhat longer than the Centronics 0.5us!
Fortunately, Linux allows you to adjust this time using the tunelp utility:
# tunelp /dev/lp1 -w nnn -a on
where nnn is the pulse length. Unfortunately the units are a) non-standard
and b) depend on the processor speed, since the driver code essentially
does the following:
wait = waittime; setstrobe(); while (wait) wait--; unsetstrobe();
I find about 2000 to be OK on a Pentium 60. There's a couple of orders of magnitude leeway in the 4070 specs so just find something that works (too small and it won't punch at all.)
The '-a on' part causes the driver to abort on errors, which is probably a good thing, as otherwise it might try to restart punching while you're halfway through rethreading the tape (there is no 'offline' switch on a 4070!)
[If you want to switch back to a normal printer, the default is:
# tunelp /dev/lp1 -w 0 -a off
The large value required by the 4070 may work with a Centronics printer
but will almost certainly slow the printer down somewhat...]
Once you've run tunelp, you should be able to use /dev/lp1 as you would
a normal ASCII printer. A good test is:
# echo 'hello, world' > /dev/lp1
which should produce the expected output on the punch (including the \n...)
Beware: if you use lp
as a loadable module,
you'll need to rerun tunelp every time you load the module...
I've connected the 'TAPE LOW' output to the Centronics 'paper empty' sensor. In fact 'TAPE LOW' is asserted when there are still 1000-10000 characters still punchable (this is settable by adjusting a screw on the 4070). TAPE LOW causes the driver to issue a sensible message.
The 'ERROR' line from the punch is connected to Centronics /ERROR. It is asserted if the tape breaks, for example. This will cause the lp driver to issue the infamous 'printer on fire' error, because it expects ERROR to mean that the printer is either out of paper or offline.
Note for Pedants: the circuit described above is technically incorrect. The 4070 is actually level triggered, in that if you fail to deassert PI within 10ms it will punch the character twice. Since the lp driver may be preempted by some more important bit of the kernel it's possible that this could occur, especially on slower machines. Feel free to design a modification and send it to pmaydell@chiark.greenend.org.uk.