EmbLogic's Blog

Interrupts in Parallel Port

  • A parallel port can generate interrupts when the voltage level on a certain input pin changes. The parallel port has to be instructed explicitly to generate interrupts and it is also possible to inhibit interrupts (e.g., while serving a previous interrupt).
  • The parallel port consists of three bytes in the I/O address space of the PC:
    1. The first byte is used as data port: 8 bits of output, often labelled D0 to D7, with D0 being the least significant bit and D7 the most significant.
    2. The second byte is used as status port: 5 bits of input (S3 – S7), 3 bits unused (S0 – S2)
    3. The third byte is used as control port:  4 bits of output (C0 – C3), 4 bits setup/unused (C4 – C7)
  • Traditionally, IBM PC systems have allocated their first two parallel ports according to the configuration in the table below:

PORT NAME     Interrupt #     Starting I/O   Ending I/O LPT1           IRQ 7          0×378           0x37f LPT2           IRQ 5           0×278           0x27f

  • In this exercise we use LPT1 with IRQ 7 and the following three bytes:
    1. 0×378 : data port
    2. 0×379 : status port
    3. 0x37A : control port
  • The parallel port standard states that setting bit C4 of the control port (0x37A) enables interrupt reporting.

The pins of the 25 pin female D type parallel port connector are shown in the following picture

  • In this picture all green pins (numbered 18 – 25) are grounded at 0 Volt.
  • When having interrupts enabled (i.e., bit C4 has been set), an interrupt will be generated by the parallel port when the voltage on input line S6 (pin 10) is raised from 0 Volt to +5 Volt. By default the input line is kept high to +5 Volt when nothing is connected. Observe that when pin 10 is shortly shorted to one of the pins 19-25, i.e., to ground, an interrupt on IRQ line 7 will be generated by the parallel port. The interrupt is generated at exactly the moment that you undo the shortage, since at that exact moment the line is raised from 0 to +5 Volt.

http://www.pstnet.com/internal/kbimage/1320-1.gif

 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>