Connect with us

parallel port output problem

Discussion in 'Electronic Design' started by rick, Feb 13, 2006.

  1. rick

    rick Guest

    Hello,

    I am a beginner in c programming. I am using turbo C. I need to
    assign one or zero to a parallel port of my laptop. I was wondering if
    I can use

    outportb (0x3BC, 0x00);

    If I am using a desktop parallel port or a laptop parallel port? Does
    it matter?
     
  2. See http://www.beyondlogic.org/
    on the subject of parallel port interfacing.

    petrus bitbyter
     
  3. Tim Wescott

    Tim Wescott Guest

    Petrius and Spehro gave you the solutions, but not the problem explanation.

    What you propose would have worked perfectly in DOS, or on a machine
    that is running in 'real' mode. Your problem is that if you have any OS
    later than Windows 2.x (OK, maybe 3.x) the OS will intercept the output
    instruction and whang you with a big illegal access exception. IIRC the
    page that Spehro pointed you to will give you a driver that intercepts
    the output to the port then outputs the byte to the port. It's kind of
    like trying to go take a pee when you're in 5th grade -- you need a hall
    pass, which is what the driver provides.

    --

    Tim Wescott
    Wescott Design Services
    http://www.wescottdesign.com

    Posting from Google? See http://cfaj.freeshell.org/google/
     

  4. I'm sorry I missed some news. My current (third) ISP also has no reliable
    newsservers. (Sigh.)

    You're only partial right about Windows. I wrote a lot of C programs using
    Turbo C using direct I/O to UARTS and printerports. All of them did well
    when running W95. I was told they did so too running W98 and Wmil but I did
    not check that out myself. They will sure not function running W2k or WXP.
    The old Turbo C is not the right tool to write programs for that OSes.

    petrus bitbyter
     
  5. budgie

    budgie Guest

    Tim, you've spent too much time with NT-based O/Ses. That HAL-interception is a
    feature of those, but Win9x doesn't have that problem. I do extensive parallel
    port I/O under 98SE and don't have any dramas. The only caveat is that if
    Windoze gets to use the port first, it soemtimes keeps some sort of hold over
    it.

    And to the O/P - the short answer is yes.
     
  6. Paul Burke

    Paul Burke Guest

    No, he'll be fine in W95,98 and Me. He'll also be OK in NT, 2000 and XP
    if he installs the (free) giveio.sys utility or one of several others of
    a similar nature.

    <http://www.cs.ucr.edu/~eblock/pages/pictools/giveio.html>

    Paul Burke
     
  7. Jem Berkes

    Jem Berkes Guest

    I am a beginner in c programming. I am using turbo C. I need to
    As others have mentioned, you have to check to see if your operating system
    will let you output data like this straight to the parallel port. It can be
    done under Linux with root privileges and a system call to get parallel
    port access, IIRC.

    Even if you're under an older Windows that allows direct access to
    hardware, check very carefully for any other drivers such as printers or
    scanners that might interfere with your parallel port experiments. This
    happened to me, and I was pulling out my hair when all that was happening
    was interference with a system driver that used the parallel port.
     
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

-