frisk@rhi.hi.is (Fridrik Skulason) (01/25/89)
I posted an article some time ago, asking for advise on how to use the
printer port for input. Most of the replies were in the "Sorry, it's
impossible" category, but a few proved to be useful (In particular one
from Craig Chaiken).
Since I received a number of "... if you find out, please let me know how.."
requests, here is a description of the method I'm using.
connect the input lines to pin bit
Acknowledge 10 7
Paper_end 12 6
Select 13 5
Error 15 4
Select_in 17 3 (see note 2)
Initialize 16 2 (see note 2)
Auto_linefeed 14 1 (see note 2)
Strobe 1 0 (see note 2)
Connect ground to pin 18
The following code fragment then reads from the port.
outp(0x037a,0x04);
k = (((inp(0x0379) & 0x78) << 1) | (inp(0x037a) & 0x0f)) ^ 0xf4;
outp(0x037a,0x00);
Note 1
you might have to change 379,37a to 3bd,3be
Note 2
some of the lines used are not true input lines, and there is a risk
that this will cause some hardware damage (a 7405 might overheat)
--
Fridrik Skulason University of Iceland
UUCP frisk@rhi.uucp BIX frisk
This line intentionally left blank ...................