Connect with us

LPT port output stuck high?

Discussion in 'Electronic Design' started by Jeffery Jones, Oct 26, 2005.

Scroll to continue with content
  1. I am trying to use an LPT port as output via a Windows driver. I have
    a program that successfully controls output bits on other PCs. As
    soon as I set the output, all 8 data lines go high and stay high, no
    matter what I set the output to (00 or FF).

    I tried manually selecting the bidirectional port control to output
    with no success. I tried to select SPP in the BIOS instead of ECP.
    MSD detects the port at 0x378 which is where I am programming.

    What can i do?

    (The port works OK with a parallel printer. Could there be a
    Windows 2000 printer driver interfering with my direct I/O? I also
    tried setting the printer to LPT2 but no success)
  2. John Miles

    John Miles Guest

    Compare the MSD result with the port's address in these three places:

    1) The CMOS setup screen (if it's visible)

    2) The port's properties in its Device Manager tab

    3) The (little-endian) value in the first two hex bytes you get
    when you do the following in a DOS box:

    If they aren't all the same, then the system may be confused as to where
    the port actually resides. You may need to remove the port in the
    Device Manager, reboot, disable it in CMOS, boot into Windows once to
    make sure it's gone, then re-enable it in CMOS and let Windows re-detect

    And yes, if you can, make sure no installed printer drivers are
    targeting the same port.

    If your CMOS setup gives you the ability to assign the port to a
    different address, you might try that, too.

    It can be a real challenge to get direct LPT port access to behave
    properly under Windows, but it is usually possible with patience and
    inappropriate language.

    -- jm
  3. ...Finally got it! I'll post here so future googlers can find
    another thing to try. It turns out that the BIOS ignored my
    suggestion to configure the port as standard parallel port and Windows
    plug N play configured it as EPP somehow. And the EPP didn't respond
    to SPP programming. So I found an EPP direct parallel port output
    programming example and it worked!

    (Took at least 3 inappropriate languages to get it to work!)

    // For this example, port_hi might be 0x778
    // and lptPort might be 0x378
    PortAccess.Output(port_hi + 2, 0x00); // switch back to mode 0
    PortAccess.Output(port_hi + 2, 0x94); // epp mode, no interrupts

    // Set port for direction write
    PortAccess.Output(lptPort + 2, 000); // direction write

    // Output some data
    PortAccess.Output(lptPort + 4, outputBits);
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day