?? ibm-pc parallel printer port - finding out how many ports are present and where.htm
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0052)http://www.doc.ic.ac.uk/~ih/doc/par/doc/finding.html -->
<HTML><HEAD><TITLE>IBM-PC Parallel Printer Port - Finding out how many ports are present and where</TITLE>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<META content="MSHTML 5.00.3315.2870" name=GENERATOR></HEAD>
<BODY bgColor=#eeeeee>
<H2>
<CENTER>IBM-PC Parallel Printer Port<BR>Finding out how many ports are present
and where </CENTER></H2>
<P>Normally, a PC can have up to 3 parallel printer ports - LPT1, LPT2 &
LPT3. Their (16-bit) base addresses in the processor's I/O space are loaded into
memory when the machine is booted, starting at address 408 Hex.
<P>A <I>well-written</I> program requiring direct access to any of these ports
should endeavour to find out which are present and where at run-time (rather
than use constant declarations as in my earlier examples!)
<P>Due to 80x86 processors being <!--"<a href="http://www.cis.ohio-state.edu/htbin/ien/ien137.html">-->"<A
href="http://sunsite.doc.ic.ac.uk/rfc/ien/ien-137.txt.3"> little-endian</A>",
the addresses are stored as follows -
<P>
<CENTER>
<TABLE bgColor=#0000cc border=0>
<TBODY>
<TR>
<TD>
<TABLE bgColor=#ddddee border=1 cellPadding=5>
<TBODY>
<TR align=middle>
<TD>408</TD>
<TD>409</TD>
<TD>40a</TD>
<TD>40b</TD>
<TD>40c</TD>
<TD>40d</TD></TR>
<TR align=middle>
<TD colSpan=2><B>LPT1</B></TD>
<TD colSpan=2><B>LPT2</B></TD>
<TD colSpan=2><B>LPT3</B></TD></TR>
<TR align=middle>
<TD>low<BR>byte</TD>
<TD>high<BR>byte</TD>
<TD>low<BR>byte</TD>
<TD>high<BR>byte</TD>
<TD>low<BR>byte</TD>
<TD>high<BR>byte</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></CENTER>
<P>For example, the following values -
<P>
<CENTER>
<TABLE bgColor=#000000 border=0>
<TBODY>
<TR>
<TD>
<TABLE bgColor=#eeeeee border=1 cellPadding=5>
<TBODY>
<TR align=middle>
<TD>408</TD>
<TD>409</TD>
<TD>40a</TD>
<TD>40b</TD>
<TD>40c</TD>
<TD>40d</TD></TR>
<TR align=middle>
<TD>78</TD>
<TD>03</TD>
<TD>78</TD>
<TD>02</TD>
<TD>00</TD>
<TD>00</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></CENTER>
<P>mean that LPT1 is at 378 Hex, LPT2 is at 278 Hex, and LPT3 is not present.
<P>
<HR>
<UL>
<LI>Here are some example programs that report which LPT ports are present and
where -
<P>
<CENTER><A href="http://www.doc.ic.ac.uk/~ih/doc/par/doc/findp.html">Turbo
Pascal</A>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -