⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interfacing the standard parallel port.htm

📁 并口的接口规范
💻 HTM
📖 第 1 页 / 共 5 页
字号:
            <TD>
              <CENTER>Data 4</CENTER></TD>
            <TD>
              <CENTER>Out</CENTER></TD>
            <TD>
              <CENTER>Data</CENTER></TD>
            <TD>
              <CENTER>&nbsp;</CENTER></TD></TR>
          <TR>
            <TD>
              <CENTER>7</CENTER></TD>
            <TD>
              <CENTER>7</CENTER></TD>
            <TD>
              <CENTER>Data 5</CENTER></TD>
            <TD>
              <CENTER>Out</CENTER></TD>
            <TD>
              <CENTER>Data</CENTER></TD>
            <TD>
              <CENTER>&nbsp;</CENTER></TD></TR>
          <TR>
            <TD>
              <CENTER>8</CENTER></TD>
            <TD>
              <CENTER>8</CENTER></TD>
            <TD>
              <CENTER>Data 6</CENTER></TD>
            <TD>
              <CENTER>Out</CENTER></TD>
            <TD>
              <CENTER>Data</CENTER></TD>
            <TD>
              <CENTER>&nbsp;</CENTER></TD></TR>
          <TR>
            <TD>
              <CENTER>9</CENTER></TD>
            <TD>
              <CENTER>9</CENTER></TD>
            <TD>
              <CENTER>Data 7</CENTER></TD>
            <TD>
              <CENTER>Out</CENTER></TD>
            <TD>
              <CENTER>Data</CENTER></TD>
            <TD>
              <CENTER>&nbsp;</CENTER></TD></TR>
          <TR>
            <TD>
              <CENTER>10</CENTER></TD>
            <TD>
              <CENTER>10</CENTER></TD>
            <TD>
              <CENTER>nAck</CENTER></TD>
            <TD>
              <CENTER>In</CENTER></TD>
            <TD>
              <CENTER>Status</CENTER></TD>
            <TD>
              <CENTER>&nbsp;</CENTER></TD></TR>
          <TR>
            <TD>
              <CENTER>11</CENTER></TD>
            <TD>
              <CENTER>11</CENTER></TD>
            <TD>
              <CENTER>Busy</CENTER></TD>
            <TD>
              <CENTER>In</CENTER></TD>
            <TD>
              <CENTER>Status</CENTER></TD>
            <TD>
              <CENTER>Yes</CENTER></TD></TR>
          <TR>
            <TD>
              <CENTER>12</CENTER></TD>
            <TD>
              <CENTER>12</CENTER></TD>
            <TD>
              <CENTER>Paper-Out / Paper-End</CENTER></TD>
            <TD>
              <CENTER>In</CENTER></TD>
            <TD>
              <CENTER>Status</CENTER></TD>
            <TD>
              <CENTER>&nbsp;</CENTER></TD></TR>
          <TR>
            <TD>
              <CENTER>13</CENTER></TD>
            <TD>
              <CENTER>13</CENTER></TD>
            <TD>
              <CENTER>Select</CENTER></TD>
            <TD>
              <CENTER>In</CENTER></TD>
            <TD>
              <CENTER>Status</CENTER></TD>
            <TD>
              <CENTER>&nbsp;</CENTER></TD></TR>
          <TR>
            <TD>
              <CENTER>14</CENTER></TD>
            <TD>
              <CENTER>14</CENTER></TD>
            <TD>
              <CENTER>nAuto-Linefeed</CENTER></TD>
            <TD>
              <CENTER>In/Out</CENTER></TD>
            <TD>
              <CENTER>Control</CENTER></TD>
            <TD>
              <CENTER>Yes</CENTER></TD></TR>
          <TR>
            <TD>
              <CENTER>15</CENTER></TD>
            <TD>
              <CENTER>32</CENTER></TD>
            <TD>
              <CENTER>nError / nFault</CENTER></TD>
            <TD>
              <CENTER>In</CENTER></TD>
            <TD>
              <CENTER>Status</CENTER></TD>
            <TD>
              <CENTER>&nbsp;</CENTER></TD></TR>
          <TR>
            <TD>
              <CENTER>16</CENTER></TD>
            <TD>
              <CENTER>31</CENTER></TD>
            <TD>
              <CENTER>nInitialize</CENTER></TD>
            <TD>
              <CENTER>In/Out</CENTER></TD>
            <TD>
              <CENTER>Control</CENTER></TD>
            <TD>
              <CENTER>&nbsp;</CENTER></TD></TR>
          <TR>
            <TD>
              <CENTER>17</CENTER></TD>
            <TD>
              <CENTER>36</CENTER></TD>
            <TD>
              <CENTER>nSelect-Printer / nSelect-In</CENTER></TD>
            <TD>
              <CENTER>In/Out</CENTER></TD>
            <TD>
              <CENTER>Control</CENTER></TD>
            <TD>
              <CENTER>Yes</CENTER></TD></TR>
          <TR>
            <TD>
              <CENTER>18 - 25</CENTER></TD>
            <TD>
              <CENTER>19-30</CENTER></TD>
            <TD>
              <CENTER>Ground</CENTER></TD>
            <TD>
              <CENTER>Gnd</CENTER></TD>
            <TD>
              <CENTER>&nbsp;</CENTER></TD>
            <TD>
              <CENTER>&nbsp;</CENTER></TD></TR></TBODY></TABLE></CENTER>
        <CENTER><FONT size=-1>Table 1. Pin Assignments of the D-Type 25 pin 
        Parallel Port Connector.</FONT></CENTER>
        <P>The above table uses "n" in front of the signal name to denote that 
        the signal is active low. e.g. nError. If the printer has occurred an 
        error then this line is low. This line normally is high, should the 
        printer be functioning correctly. The "Hardware Inverted" means the 
        signal is inverted by the Parallel card's hardware. Such an example is 
        the Busy line. If +5v (Logic 1) was applied to this pin and the status 
        register read, it would return back a 0 in Bit 7 of the Status Register. 
        </P>
        <P>The output of the Parallel Port is normally TTL logic levels. The 
        voltage levels are the easy part. The current you can sink and source 
        varies from port to port. Most Parallel Ports implemented in ASIC, can 
        sink and source around 12mA. However these are just some of the figures 
        taken from Data sheets, Sink/Source 6mA, Source 12mA/Sink 20mA, Sink 
        16mA/Source 4mA, Sink/Source 12mA. As you can see they vary quite a bit. 
        The best bet is to use a buffer, so the least current is drawn from the 
        Parallel Port. </P></UL><A name=3><I><FONT size=+2>Centronics?</FONT></I>
      <HR>
      </A> 
      <UL>
        <P>Centronics is an early standard for transferring data from a host to 
        the printer. The majority of printers use this handshake. This handshake 
        is normally implemented using a Standard Parallel Port under software 
        control. Below is a simplified diagram of the `Centronics' Protocol. 
</P>
        <CENTER><IMG alt="Centronics Waveform" 
        src="Interfacing the Standard Parallel Port.files/centron.gif" 
        border=0></CENTER>
        <P>Data is first applied on the Parallel Port pins 2 to 7. The host then 
        checks to see if the printer is busy. i.e. the busy line should be low. 
        The program then asserts the strobe, waits a minimum of 1uS, and then 
        de-asserts the strobe. Data is normally read by the printer/peripheral 
        on the rising edge of the strobe. The printer will indicate that it is 
        busy processing data via the Busy line. Once the printer has accepted 
        data, it will acknowledge the byte by a negative pulse about 5uS on the 
        nAck line. </P>
        <P>Quite often the host will ignore the nAck line to save time. Latter 
        in the Extended Capabilities Port, you will see a Fast Centronics Mode, 
        which lets the hardware do all the handshaking for you. All the 
        programmer must do is write the byte of data to the I/O port. The 
        hardware will check to see if the printer is busy, generate the strobe. 
        Note that this mode commonly doesn't check the nAck either. </P></UL><A 
      name=4><I><FONT size=+2>Port Addresses</FONT></I>
      <HR>
      </A> 
      <UL>
        <P>The Parallel Port has three commonly used base addresses. These are 
        listed in table 2, below. The 3BCh base address was originally 
        introduced used for Parallel Ports on early Video Cards. This address 
        then disappeared for a while, when Parallel Ports were later removed 
        from Video Cards. They has now reappeared as an option for Parallel 
        Ports integrated onto motherboards, upon which their configuration can 
        be changed using BIOS. </P>
        <P>LPT1 is normally assigned base address 378h, while LPT2 is assigned 
        278h. However this may not always be the case as explained later. 378h 
        &amp; 278h have always been commonly used for Parallel Ports. The lower 
        case h denotes that it is in hexadecimal. These addresses may change 
        from machine to machine. </P><BR>
        <CENTER>
        <TABLE width="80%" border=1>
          <TBODY>
          <TR>
            <TD width="30%">
              <CENTER><B>Address</B></CENTER></TD>
            <TD>
              <CENTER><B>Notes:</B></CENTER></TD></TR>
          <TR>
            <TD vAlign=top>
              <CENTER>3BCh - 3BFh</CENTER></TD>
            <TD>Used for Parallel Ports which were incorporated on to Video 
              Cards - Doesn't support ECP addresses</TD></TR>
          <TR>
            <TD>
              <CENTER>378h - 37Fh</CENTER></TD>
            <TD>Usual Address For LPT 1</TD></TR>
          <TR>
            <TD>
              <CENTER>278h - 27Fh</CENTER></TD>
            <TD>Usual Address For LPT 2</TD></TR></TBODY></TABLE><FONT size=-1>Table 
        2 Port Addresses</FONT></CENTER>
        <P>When the computer is first turned on, BIOS (Basic Input/Output 
        System) will determine the number of ports you have and assign device 
        labels LPT1, LPT2 &amp; LPT3 to them. BIOS first looks at address 3BCh. 
        If a Parallel Port is found here, it is assigned as LPT1, then it 
        searches at location 378h. If a Parallel card is found there, it is 
        assigned the next free device label. This would be LPT1 if a card wasn't 
        found at 3BCh or LPT2 if a card was found at 3BCh. The last port of 
        call, is 278h and follows the same procedure than the other two ports. 
        Therefore it is possible to have a LPT2 which is at 378h and not at the 
        expected address 278h. </P>
        <P>What can make this even confusing, is that some manufacturers of 
        Parallel Port Cards, have jumpers which allow you to set your Port to 
        LPT1, LPT2, LPT3. Now what address is LPT1? - On the majority of cards 
        LPT1 is 378h, and LPT2, 278h, but some will use 3BCh as LPT1, 378h as 
        LPT1 and 278h as LPT2. <I>Life wasn't meant to be easy.</I> </P>
        <P>The assigned devices LPT1, LPT2 &amp; LPT3 should not be a worry to 
        people wishing to interface devices to their PC's. Most of the time the 
        base address is used to interface the port rather than LPT1 etc. However 
        should you want to find the address of LPT1 or any of the Line PrinTer 
        Devices, you can use a lookup table provided by BIOS. When BIOS assigns 
        addresses to your printer devices, it stores the address at specific 
        locations in memory, so we can find them. </P>
        <CENTER>
        <TABLE width="60%" border=1>
          <TBODY>
          <TR>
            <TD width="40%"><B>
              <CENTER>Start Address</CENTER><B></B></B></TD>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -