📄 jan axelson's parallel port faq.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0030)http://www.lvr.com/jansfaq.htm -->
<HTML><HEAD><TITLE>Jan Axelson's Parallel Port FAQ</TITLE>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="Jan Axelson" name=Author>
<META content="MSHTML 5.00.3315.2870" name=GENERATOR>
<META content=none name="Microsoft Border"></HEAD>
<BODY bgColor=#ffffff>
<TABLE border=1
style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; BORDER-RIGHT: medium none; BORDER-TOP: medium none"
width="100%">
<TBODY>
<TR>
<TD align=left bgColor=#c0c0c0 borderColor=#ffffff borderColorDark=#ffffff
borderColorLight=#ffffff vAlign=top width="20%"><!-- #BeginLibraryItem "/Library/menu.lbi" --><STRONG><FONT
face=Helvetica>Website <BR>Quick Reference </FONT></STRONG>
<P><IMG align=left height=18
src="Jan Axelson's Parallel Port FAQ_files/triblu.gif" width=14><A
href="http://www.lvr.com/index.html"><SMALL>Lakeview Research
home</SMALL></A><BR><IMG align=left height=18
src="Jan Axelson's Parallel Port FAQ_files/triblu.gif" width=14><A
href="http://www.lvr.com/index.html#Contact%20Information"><SMALL>Contact
Info</SMALL></A><BR><IMG align=left height=18
src="Jan Axelson's Parallel Port FAQ_files/triblu.gif" width=14><A
href="http://www.lvr.com/press.htm"><SMALL>News for the
Press</SMALL></A><BR><IMG align=left height=18
src="Jan Axelson's Parallel Port FAQ_files/triblu.gif" width=14><A
href="http://www.lvr.com/aboutjan.htm"><SMALL>About Jan</SMALL></A></P>
<P><STRONG>Books<BR></STRONG><IMG align=left height=18
src="Jan Axelson's Parallel Port FAQ_files/triylw.gif" width=14><I><A
href="http://www.lvr.com/usbc.htm"><SMALL>USB
Complete</SMALL></A></I><BR><IMG align=left height=18
src="Jan Axelson's Parallel Port FAQ_files/triylw.gif" width=14><I><A
href="http://www.lvr.com/spc.htm"><SMALL>Serial Port
Complete</SMALL></A><BR></I><IMG align=left height=18
src="Jan Axelson's Parallel Port FAQ_files/triylw.gif" width=14><I><A
href="http://www.lvr.com/parprtib.htm"><SMALL>Parallel Port
Complete</SMALL></A></I><I><BR></I><IMG align=left height=18
src="Jan Axelson's Parallel Port FAQ_files/triylw.gif" width=14><I><A
href="http://www.lvr.com/microcib.htm"><SMALL>The Microcontroller Idea
Book</SMALL></A><BR></I><IMG align=left height=18
src="Jan Axelson's Parallel Port FAQ_files/triylw.gif" width=14><I><A
href="http://www.lvr.com/makpcbds.htm"><SMALL>Making Printed Circuit
Boards</SMALL></A></I></P>
<P><IMG align=left height=18
src="Jan Axelson's Parallel Port FAQ_files/triylw.gif" width=14><SMALL><A
href="http://www.lvr.com/ordering.htm"><STRONG>How to Order</STRONG></A>
</SMALL></P>
<P><STRONG>ResourcePages<BR></STRONG><IMG align=left height=18
src="Jan Axelson's Parallel Port FAQ_files/trired.gif" width=14><SMALL><A
href="http://www.lvr.com/usb.htm">USB</A><BR><IMG align=left height=18
src="Jan Axelson's Parallel Port FAQ_files/trired.gif" width=14><A
href="http://www.lvr.com/serport.htm">Serial Port</A></SMALL><A
href="http://www.lvr.com/serport.htm">s</A><BR><IMG align=left height=18
src="Jan Axelson's Parallel Port FAQ_files/trired.gif" width=14><A
href="http://www.lvr.com/parport.htm"><SMALL>Parallel
Port</SMALL></A><BR><IMG align=left height=18
src="Jan Axelson's Parallel Port FAQ_files/trired.gif" width=14><A
href="http://www.lvr.com/microc.htm"><SMALL>8052-Basic</SMALL></A> <A
href="http://www.lvr.com/microc.htm"><SMALL>Microcontrollers</SMALL></A><BR><IMG
align=left height=18
src="Jan Axelson's Parallel Port FAQ_files/trired.gif" width=14><A
href="http://www.lvr.com/pcbs.htm"><SMALL>PC Boards</SMALL></A><BR><IMG
align=left height=18
src="Jan Axelson's Parallel Port FAQ_files/trired.gif" width=14><A
href="http://www.lvr.com/articles.htm"><SMALL>Magazine
Articles</SMALL></A></P><!-- #EndLibraryItem -->
<P> </P>
<P> </P></TD>
<TD align=left bgColor=#ffffff borderColor=#ffffff borderColorDark=#ffffff
borderColorLight=#ffffff vAlign=top width="80%">
<H1 align=center><FONT face=Helvetica>Jan's Parallel Port FAQ </FONT></H1>
<P align=center><FONT face=Helvetica><STRONG>Answers to some frequently
asked questions about the PC's parallel port </STRONG></FONT></P>
<P align=center><FONT face=Helvetica><STRONG>by Jan
Axelson</STRONG></FONT></P>
<P>This FAQ contains my answers to parallel-port questions that I have
answered in newsgroups, forums, or direct email. Because many of the same
topics come up again and again, I've collected the most common ones in
this document. </P>
<P>Most are specific, technical questions relating to programming,
interfacing, or using the parallel port. For more basic information about
the parallel port and its many modes, see the other information and links
at Lakeview Research's web site: <A
href="http://www.lvr.com/parport.htm">http://www.lvr.com/parport.htm</A></P>
<P>Thanks to the questioners for some thought-provoking queries! </P>
<P>Latest update: 11/3/01</P>
<P>You may distribute this FAQ if you distribute the entire document and
charge nothing except minimal download or media charges. </P>
<P>Jan Axelson <BR>jan@lvr.com </P>
<H2>General Interfacing </H2>
<P><I>Q: When I write a byte to a port address, I don't see the value at
the connector/cable/peripheral.</I></P>
<P>A: If you don't see what you expect at the other end, the reason is
probably one of the following:</P>
<UL>
<LI>You're writing to the wrong address. Remember that 378 in
hexadecimal is 888 in decimal.
<LI>You're looking on the wrong pin. Verify the wiring of any cable
you're using.
<LI>You're running NT and trying to access a port directly. NT requires
a kernel-mode driver.
<LI>External circuits connected to the port are preventing the bits from
toggling. Disconnect the circuits and measure again.
<LI>You forgot that Control port bits 0, 1, and 3 are inverted between
the port register and the connector pins. When you write to the Control
port, these bits will be the inverse of what you write.
<LI>The port supports PS/2 mode and you've written 1 to Control port,
bit 5, disabling the Data port's outputs. Write 0 to this bit to enable
the outputs.
<LI>You're trying to connect two PCs' parallel ports and you aren't
using the required LapLink-type cable and software that transmits four
bits at a time.
<LI>A low-level Windows driver has prevented access to the port. This is
rarely a problem with the parallel port, however. </LI></UL>
<P><I>Q: When I read a port, the value I read doesn't match the value at
the connector/cable/peripheral.</I></P>
<P>A: If you don't read what you expect, the reason is probably one of the
following:</P>
<UL>
<LI>You're reading the wrong address. Remember that 378 in hexadecimal
is 888 in decimal.
<LI>You're looking on the wrong pin. Verify the wiring of any cable
you're using.
<LI>You're running NT and trying to access a port directly. NT requires
a kernel-mode driver.
<LI>You forgot that Control port bits 0, 1, and 3 and Status port bit 7
are inverted between the port register and the connector pins. When you
read these ports, these bits will be the inverse of the logic states at
the connector.
<LI>You're reading the data port and your port doesn't support PS/2
mode. You can't disable the data outputs, and will read the last value
written to the port, rather than the logic states at the connector.
<LI>The port supports PS/2 mode and you haven't written 1 to Control
port, bit 5, disabling the Data port's outputs. Write 1 to this bit to
enable reading external signals on the data lines.
<LI>A low-level Windows driver has prevented access to the port. This is
rarely a problem with the parallel port, however. </LI></UL>
<P><I>Q: I need to make an interface to emulate a printer that is on-line
and with paper. I have a program that needs three printers, but two of the
outputs don't interest me and if I don't have the printers connected, the
program doesn't work. </I></P>
<P>A: To fool the software into thinking that a printer is connected, try
this: Tie -Error (pin 15) high (+5V). Tie PaperEmpty (pin 12) low (0V).
Tie Busy (pin 11) low (0V). Matthew Chapman also recommends tying -Select
(pin 17) low and pin 12 (Select In) high.</P>
<P>John Sawyer successfully used this wiring to emulate a printer
connection:<BR>1 (data strobe) ---> 10 (Ack)<BR>11(busy) , 12(paper
end), 17(select inhibit) --> Ground<BR>13(select) --> 15(!error)
--Tied together, but floating</P>
<P>Also from Matthew Chapman: In VB, do not use ' Printer.Print Chr(xxx) '
followed by ' Printer.EndDoc ' (to start printing), because that will
start endlessly spooling and won't reach the final stage, which is to
output the byte for printing. Use ' Text1.Text = "" ' and ' Text2.Text =
Chr(255) ' in the ' Form_Load ' procedure and ' Text1.SelPrint
(Printer.hDC) ' followed by ' Text2.SelPrint (Printer.hDC) ' in the '
Command1_Click ' procedure to output the byte value of 255 to the printer
port (regardless of which printer driver you are using) whenever you click
on the command button. </P>
<P><I>Q: I'm trying to input a stream of data into pin 12 but I get
garbage on other computers and mine works fine. I'm using the output pin
number 8 on a 74F299 to serially load the data into the computer. I use
the data and control ports for control signals, and these work fine.
</I></P>
<P>A: Sending data at high speeds over a long cable can cause problems.
The components used to implement the parallel port can vary from system to
system, so a marginal circuit may work with some ports & not others.
You might want to try these:
<UL>
<LI>Use a slower logic family (LSTTL, HCTMOS). (Decreases
transmission-line effects.)
<LI>Buffer the inputs and outputs that connect to the cable. Use a
74HC244 or 74LS244 buffer/driver or similar. (For isolation, strong
drivers, Schmitt-trigger inputs.)
<LI>Slow the clock that controls the bit transmissions.
<LI>Use a short cable (6 feet or less). </LI></UL>
<P><I>Q: The status register on the parallel port is used for input. Why
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -