Path: utzoo!attcan!uunet!ncrlnk!ncrcae!hubcap!gatech!purdue!decwrl!pyramid!prls!philabs!pwa-b!hgcvax!network From: network@hgcvax.uucp (craig chaiken) Newsgroups: comp.sys.ibm.pc Subject: Re: Using the printer port for input Summary: Parallel Port as input port Message-ID: <691@hgcvax.uucp> Date: 13 Jan 89 05:21:40 GMT References: <704@krafla.rhi.hi.is> Organization: Hartford Graduate Center, Hatrford, CT. Lines: 33 In article <704@krafla.rhi.hi.is>, frisk@rhi.hi.is (Fridrik Skulason) writes: > I need to connect a set of eight switches to my PC. The most simple way > to do it seems to be connecting them to the parallel port, and using it > as input port instead of output. > > My question is: Does anyone have a code fragment (in C, assembler or > whatever) for changing the port into an input port? > (*** The following is an except of my, soon to be published book, ***) (*** _Blueprint of a Local Area Network_. It soon be available from ***) (*** M & T Publishing for $24.95 sometime around July. The book ***) (*** provides the source code and details the hardware necessary to ***) (*** build an inexpensive, customized IBM PC Local Area network. ***) (*** Both hardware hackers an assembly language programmers, alike ***) (*** will find that it is chock full of useful information, and ***) (*** techniques. ***) The parallel port on the IBM PC was designed for use with a parallel printer. It provides 8 output-only lines, mapped to bits 0 through 7 of I/O port 0378H, which are data bit 0 through data bit 7. It provides 5 input-only lines. mapped to bits 3 through 7 of I/O port 0379H, which are ERROR, SELECT, PAPER_END, ACKNOWLEDGE, and BUSY. And it provides 4 input/output lines, mapped to bits 0 through 3 of I/O port 037AH, which are STROBE, AUTO_LINE_FEED, INITIALIZE, and SELECT_IN (* Note - in order to input from this port, you must first send 04H to I/O port 037AH *). BUSY, AUTO_LINE_FEED, and STROBE input signals are inverted by the hardware, and must be negated in software. (*** End of Excerpt from Blueprint of a Local Area Network ***) Craig Chaiken Hartford Graduate Center Computing Services