ycy@walt.cc.utexas.edu (Joseph Yip) (07/14/90)
Hi, I am trying to use IBM PC's parallel port (printer port) as digital output port. This will save me from buying a digital I/O card. The printer port is an 8-bit output. I do not know if the output is latched or not. This means that if I send a character to the printer port, will the 8-bit lines stay the same. I am thinking of using the parallel port to control a stepper motor. If the parallel port is not latched, what is the easiest way to make it latch? Thank you. - Joseph Yip Email: joseph@zeus.ee.utexas.edu Tel: (512) 471-1862 Addr: ECE, ENS 520, UT Austin, Austin, TX 78712
depolo@eniac.seas.upenn.edu (Jeff DePolo) (07/14/90)
In article <33965@ut-emx.UUCP> ycy@walt.cc.utexas.edu (Joseph Yip) writes: >Hi, > >I am trying to use IBM PC's parallel port (printer port) as digital >output port. This will save me from buying a digital I/O card. >The printer port is an 8-bit output. I do not know if the output is >latched or not. This means that if I send a character to the printer >port, will the 8-bit lines stay the same. I >am thinking of using the parallel port to control a stepper motor. Good question. About the best I can do is give you a wishy-washy answer. I know that the parallel port is also capable of _receiving_ data. If you've ever seen some of the parallel port file transfer programs, you'll see that the parallel port is quite capable of bidirectional communication. To get the port to read data, all you do is have the sending computer write bytes out its parallel port, which then get latched in the receiving computer's parallel port. Then simply read the contents of the parallel port on the receiving computer. However, when sending, I would guess that whether or not the data actually remains at the port after it is received would depend on current drain on the port. For example, if there was originally a 1 in bit 0 on the parallel port, if the other end of the cable had a low Z with respect to ground, the 1 would become a 0. I have a feeling that this would not be the case with a normal serial port, as if it were the case, then every time a receiving device (such as a printer) went to read the port, the 1's would often drop to 0's in the middle of the poll. So, my guess is that it would depend on the receiving device as to whether or not the data would stay latched. > >If the parallel port is not latched, what is the easiest way to >make it latch? Get an octal latch connected to the 8 data lines with the latch-load line connected to the strobe line. When the strobe is set high, the contents of the port will get stuck in the latch until the next byte is written. Obviously this scheme won't prevent data overruns, however. Depending on your application, you may need some sort of buffering. --- Jeff +-----------------------+-----------------------------------------------------+ | Jeff DePolo N3HBZ/AA | Internet: depolo@eniac.seas.upenn.edu | | Univ. of Pennsylvania | RF: 146.685- 224.40- 442.70+ 144.455s (Philadelpia) | | Computer Science Eng. | Twisted pair: (215) 386-7199 home | | Class of 1991 | Carrier pigeon: 420 South 42nd St. Philly, PA 19104 | +-----------------------+-----------------------------------------------------+
mjw06513@uxa.cso.uiuc.edu (Mary Winters) (07/15/90)
In article <33965@ut-emx.UUCP> ycy@walt.cc.utexas.edu (Joseph Yip) writes: >Hi, > >I am trying to use IBM PC's parallel port (printer port) as digital >output port. This will save me from buying a digital I/O card. >The printer port is an 8-bit output. I do not know if the output is >latched or not. This means that if I send a character to the printer >port, will the 8-bit lines stay the same. I >am thinking of using the parallel port to control a stepper motor. I believe it is. I use a printer port to control various devices, including VCRs and an IR controller. When you write a value to the output lines of the printer port, the states of the output lines remain the same until you write a different value. -- uv@f69.n233.z1.fidonet.org Suffering from PMS (Presentation Manager Syndrome)
brian@ucsd.Edu (Brian Kantor) (07/15/90)
The IBM technical reference manual shows an LS374 in there, which is an 8-bit latch. The data lines are latched, but there's an LS244 reading them back in when you read from the port so that you can perform a self-test by reading back the byte you had just output. Thus you can make the port bi-directional if you want. Just chop the wire from the latch's output enable pin, and run it out to a spare pin on the connector. The external device would control the direction. There are other strobe and control lines, some in each direction. Best you check a schematic if you're planning to hack it. - Brian
ergo@netcom.UUCP (Isaac Rabinovitch) (07/15/90)
In <15568@ucsd.Edu> brian@ucsd.Edu (Brian Kantor) writes: >The IBM technical reference manual shows an LS374 in there, which is an >8-bit latch. The data lines are latched, but there's an LS244 reading >them back in when you read from the port so that you can perform a >self-test by reading back the byte you had just output. >Thus you can make the port bi-directional if you want. Just chop the >wire from the latch's output enable pin, and run it out to a spare pin >on the connector. The external device would control the direction. >There are other strobe and control lines, some in each direction. Best >you check a schematic if you're planning to hack it. This subject has come up in the computing conferences, and one little detail came up that's worth mentioning here. Many "IBM-compatible" machines differ from the PC in various minor ways (even IBM's own laptop machine was notorious for this) and the printer port is an obvious place to cut corners -- most printers don't really *need* a bi-directional channel, do they? The upshot is that one shouldn't assume that a given clone's parallel port's bidirectional, and (say some pundits) you can even damage some machines by trying to use them that way. I should emphasize that I'm not qualified to defend or even amplify the above. -- ergo@netcom.uucp Isaac Rabinovitch atina!pyramid!apple!netcom!ergo Silicon Valley, CA uunet!mimsy!ames!claris!netcom!ergo "I hate quotations. Tell me what you know!" -- Ralph Waldo Emerson
markz@ssc.UUCP (Mark Zenier) (07/16/90)
In article <15568@ucsd.Edu>, brian@ucsd.Edu (Brian Kantor) writes: > The IBM technical reference manual shows an LS374 in there, which is an > 8-bit latch. The data lines are latched, but there's an LS244 reading > them back in when you read from the port so that you can perform a > self-test by reading back the byte you had just output. > > Thus you can make the port bi-directional if you want. Just chop the > wire from the latch's output enable pin, and run it out to a spare pin > on the connector. The external device would control the direction. In a old TTL implementation, you can also route the output enable to an unused bit in the control register. This is a configuration jumper on some boards. There was a article 2-3 years ago in Computer Shopper giving the gory details. Markz@ssc.uucp
ftpam1@acad3.fai.alaska.edu (MUNTS PHILLIP A) (07/16/90)
In article <905@ssc.UUCP>, markz@ssc.UUCP (Mark Zenier) writes... >In article <15568@ucsd.Edu>, brian@ucsd.Edu (Brian Kantor) writes: >> The IBM technical reference manual shows an LS374 in there, which is an >> 8-bit latch. The data lines are latched, but there's an LS244 reading >> them back in when you read from the port so that you can perform a >> self-test by reading back the byte you had just output. >> >> Thus you can make the port bi-directional if you want. Just chop the >> wire from the latch's output enable pin, and run it out to a spare pin >> on the connector. The external device would control the direction. > >In a old TTL implementation, you can also route the output enable to an >unused bit in the control register. This is a configuration jumper on >some boards. There was a article 2-3 years ago in Computer Shopper >giving the gory details. > >Markz@ssc.uucp My laptop, a T1000, has this mod built into the ASIC already. Bit 7 of port 37AH needs to be set to turn off the output drivers. Port 378H accesses the data registers. Coincidentally, I just spent this evening putting an analog to digital converter on the printer port, so I have all the gory details if anyone wants them. (I'm using the port in both directions and some of the handshaking lines, as well.) Philip Munts N7AHL NRA Extremist, etc. University of Alaska, Fairbanks
grege@gold.GVG.TEK.COM (Greg Ebert) (07/16/90)
In article <33965@ut-emx.UUCP> ycy@walt.cc.utexas.edu (Joseph Yip) writes: >Hi, > >I am trying to use IBM PC's parallel port (printer port) as digital >output port. This will save me from buying a digital I/O card. Yes, the parallel port uses a latched output driver, usually a 74xx373. It also has readback, so if you write to the port you can read-back whatever was written. The I/O address is either 278h, 378h, or 3BCh. Use DEBUG to find it, or look at 40:0 for the pointers. If you are only using the 8 data lines, you don't need to worry about the status/control lines.