Murray_Thessman@f170.n771.z3.fidonet.org (Murray Thessman) (01/24/91)
FSC-Control: EID:d9a7 163896b5 From: Murray Thessman Keywords: parallel port I/O Organization: GenBOARD of Wellington New Zealand, INFN# (3:771/160) In a msg from BonaFido (our UseNet gateway) 22-Jan-91, Winthrop Chan wrote .. >WDC: Hi, I'm trying to find data on how to use the IBM-PC parallel port for >WDC: both output and INPUT. I know this can be done since quite a few >WDC: transfer programs do this trick. I need port numbers and how they do >WDC: it. I repeat a msg I wrote to David Ingram in Zone3_Tech on Fido on 5-Jan-91. I hope that this is what you were after.... In a message of <Jan 01 15:12>, David Ingram (3:770/110) writes: >DI: Could somebody please tell me how I can control the printer port for >DI: input and output (e.g. controlled a robot). The standard parallel printer port found on most Herc, EGA or parallel printer port is made up of 3 separate ports: an 8 bit output, a 5 bit input and a 4 bit quuasi bi-directional port. The 8 bit is quite straight forward. The 8 bit data is sent to an Octal latch (74LS374) then directly to the D25 (bits 0-7 -> DB25 pins 2, 3, 4, 5, 6, 7, 8, 9). There is also an octal tristate buffer (74LS244) to provide feedback which allows some printer drivers to verify the integrity (ie no short circuits). Both these ICs have the same address. The 5 bit input port is via means of inverting tristate buffers but before reaching the buffers SOME bits pass through additional inverters. These bits have been inverted twice and will therefore be correct! (bits 3-7 -> DB25 pins 15, 13, 12, 10, 11). Only bit 7 needs inverting by software. Note that DB25 pin 10 (Bit 6) is also connected to interrupt IRQ7 and can be used to generate interupts if these are enabled. The 4 bit quasi bi-directional port use open collector output drivers with 4K7 pull-up resistors on board. By switching the output drivers off (ie logic 1 state) the port can be used as an input port. This means that to switch the output drivers off the bit pattern 0100 (04 decimal) must be output to this port. When inputting, the input buffer is itself an inverter so that the line that passes through a further inverter (bit b2) will be input in the correct sense. This means that the remaining bits b0, b1, and b3 will need inverting by the software. To save you working out the (almost complicated) logic <grin> Constant BasePort = $378 { change to $3BC if on EGA or Herc } { see table below } Procedure InitInput; { init bi-direct port to input only} Port[BasePort + 2]:= 04; { switch off drivers } end; Procedure InputIBM (var combined: byte); { Input from 4-bit and 5-bit ports, combine into a single 8-bit number and corrects inverted bits } var hi,lo : byte; begin hi:=Port[BasePort + 1] and $F0; { input } lo:=Port[BasePort + 2] and $0F { input } combined := hi or lo; { combined nibbles } combined := combined xor $8B; { invert bits 0, 1, 3, 7 } end; One last thing the port adresses PARRALLEL EGA or PORT PRINTER CARD HERCULES CARD 8 bit outport 378 Hex 3BC Hex 5 bit input 379 Hex 3BD Hex 4 bit bi-directional 37A Hex 3BE Hex [ The above information was obtained from NEWelectronicS/March 1988 'Getting the best from a standard printer port - Jeff Broard' Pg 33] >DI: I'm sure it can be done somehow. Yes you where right! I plan to use the printer port it to switch the modem off and back on if I get a 'Modem not okay' (exit error 2) from OPUS to reset everything. BTW LPT 2 & LPT 3 Will have different addresses. [Just as a trailer I wouldn't mind a reply from you if you get this (always suspicious of gateways - sorry John)] regards Murray --- msged 2.05 * Origin: GenBOARD, A genealogy BBS: Wgtn,NZ (64)(4)4990-490 (3:771/160) SEEN-BY: 771/110 150 160 170 180 772/20 FSC-Control: PATH: 771/160 110
crs@lanl.gov (Charlie Sorsby) (02/02/91)
In article <7883@umd5.umd.edu>, wchan@umd5.umd.edu (Winthrop D Chan) writes: > Hi, I'm trying to find data on how to use the IBM-PC parallel port for both > output and INPUT. I know this can be done since quite a few transfer programs > do this trick. I need port numbers and how they do it. I'd appreciate similar information about both parallel and serial ports. To be more specific, I'd like to be able to use the ports from C programs (microSoft C 5.1 at the moment) but I'm not super-familiar with PC's and where to find the information that I need. Any help will be sincerely appreciated. E-mail is prefered for I can't seem to keep up with news. Sigh... If I receive useful information, I'll happily summarize for the net. Thanks. Best, Charlie Sorsby "I'm the NRA!" crs@lanl.gov