Thread: how to control pinter port read/write using C++

  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    38

    how to control pinter port read/write using C++

    Dear all,
    how to control parallel port using visual c++?when i send a data to parallel port, it will be displayed in computer screen, How to do that, Thank you.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    If you want to run this on an NT based machine, you'll need something like GiveIO to enable access to the inp and outp instructions.
    A good resource.
    More resources.

    gg

  3. #3
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    Under NT and other 32 bit versions, you can get a handle to the ports with the CreateFile() API function. Look in the help - particulaly the section that deals with "communications resources". Once you have a handle you can use any of the handle based I/O routines to read and write the port. You do not need another library. inp and outp are 16 bit legacy stuff.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    I assumed that he needed to control I/O on individual pins (from this other thread).
    If he can connect the ADC to the parallel port in a way that normal reads on LPT1 return correct values, then that would be the ideal solution.

    "inp and outp are 16 bit legacy stuff"
    Since the x86 architecture uses port mapped I/O to access registers and devices (as opposed to memory mapped I/O), you wouldn't be able to write device drivers (that don't use DMA) without the IN and OUT instructions.

    inp() and outp() are simply C function wrappers for the IN and OUT instructions. They are considered "old-school" because those instructions are priviliged under NT/2000/XP (unless you use something like GiveIO or UserPort to give your process permissions to use those instructions).

    gg

  5. #5
    Registered User
    Join Date
    Oct 2003
    Posts
    38
    Thank you,
    How to use _inp(), it takes one parameter, while _outp() takes two parameters,are they?
    i think it is just few lines(program) if display the signal in computer through parallel port, isn't it?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. FTP program
    By jakemott in forum Linux Programming
    Replies: 14
    Last Post: 10-06-2008, 01:58 PM
  2. Replies: 3
    Last Post: 02-29-2008, 01:29 PM
  3. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  4. Button handler
    By Nephiroth in forum Windows Programming
    Replies: 8
    Last Post: 03-12-2006, 06:23 AM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM